Skip to content

gnorium/admin-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AdminCore, as used in gnorium.com

Core functionality for an admin console for Swift-based web applications.

Overview

AdminCore provides a structured, type-safe API for defining and rendering administrative interfaces in Swift. It allows developers to register models using the ModelAdmin protocol and automatically generates dashboards, forms, and editors.

Features

  • Declarative Configuration: Define admin interfaces using the ModelAdmin protocol.
  • Pre-built Views: Ready-to-use components for dashboards, login, and markdown editing.
  • Interactivity: Built-in WebAssembly (WASM) hydration for client-side behaviors.
  • Integration: Seamlessly works with HTMLBuilder, CSSBuilder, and DesignTokens.

Installation

Swift Package Manager

Add AdminCore to your Package.swift:

dependencies: [
    .package(url: "https://github.com/gnorium/admin-core", branch: "main")
]

Then add it to your target dependencies:

.target(
    name: "YourTarget",
    dependencies: [
        .product(name: "AdminCore", package: "admin-core")
    ]
)

Usage

import AdminCore

struct ArticleAdmin: ModelAdmin {
    let modelName = "Article"
    let modelNamePlural = "Articles"
    let listFields = ["title", "slug", "status", "createdAt"]
    
    var editFields: [FieldConfig] {
        [
            .text(name: "title", label: "Title"),
            .slug(name: "slug", label: "Slug", sourceField: "title"),
            .markdown(name: "content", label: "Body Content")
        ]
    }
}

// In your application logic:
Registry.shared.register(ArticleAdmin())

Requirements

  • Swift 6.2+

License

Apache License 2.0 - See LICENSE for details

Contributing

Contributions welcome! Please open an issue or submit a pull request.

Related Packages

About

AdminCore, as used in gnorium.com

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages