Setup and Installation
Relevant source files
The following files were used as context for generating this wiki page:
The SeaORM Pro project is a full-stack framework designed for rapid deployment of professional admin panels. It leverages SeaORM for database interactions, Seaography for GraphQL capabilities, and the Loco.rs framework for backend orchestration. The installation process involves configuring database backends, seeding initial data, and deploying pre-built frontend assets.
Sources: README.md:1-10, Cargo.toml:10-25, pro_admin/dashboard.toml:11-14
Initial Environment Configuration
Before running the application, developers must configure the environment and database backends. The project supports SQLite, MySQL, and PostgreSQL. SQLite is the default configuration, requiring no additional setup for local development.
Database Backend Selection
The DATABASE_URL must be specified in a .env file. Corresponding features must be enabled in Cargo.toml to include the required drivers.
| Database | Connection String Example | Cargo.toml Feature |
|---|---|---|
| SQLite | sqlite://db.sqlite?mode=rwc | sqlx-sqlite |
| MySQL | mysql://root:root@localhost/dbname | sqlx-mysql |
| PostgreSQL | postgres://root:root@localhost/dbname | sqlx-postgres |
Sources: README.md:12-25, Cargo.toml:44-48
The following diagram illustrates the initialization flow of the backend server:
The application flow begins with loading environment variables and establishing a database connection before initializing the web server.
Sources: examples/axum_example/api/src/lib.rs:35-55, README.md:54-58
Data Seeding and Migrations
The project includes a specialized seeding task to populate the database with demo data or initial user records.
Seed Task Execution
Seeding is handled through a CLI task. This task can either migrate the database normally or reset the entire structure before inserting data.
- Standard Seed:
cargo run task seed_data - Refresh and Seed:
cargo run task seed_data refresh:true
The SeedData task handles various CSV/TSV encodings (UTF-16LE, Windows-1252) and uses insert_many to process records in chunks of 100 for efficiency.
Sources: README.md:27-52, src/tasks/seed.rs:18-40, src/tasks/seed.rs:114-123
Frontend Deployment
The admin panel frontend is distributed as a pre-compiled asset package. This must be downloaded and extracted into the assets/admin directory to enable the web interface.
Download Process
The project provides a utility script build_tools/download_frontend.sh which:
- Clears existing assets in
assets/admin. - Downloads the latest
admin_panel.tar.gzfrom the SeaQL GitHub releases. - Extracts the contents into the local project structure.
Sources: README.md:54-55, build_tools/download_frontend.sh:4-13
Project Scaffolding and Customization
To transition from the demo environment to a production-ready application, the project includes a scaffolding utility to remove demo entities and reset configurations.
The scaffolding script automates the removal of boilerplate code and demo data configurations.
Sources: build_tools/scaffold.sh:4-21, README.md:71-75
Manual Customization Steps
After running the scaffold script, developers must perform the following:
- Update
.envwith production database credentials. - Generate new entities using
sea-orm-cli:sea-orm-cli generate entity -o src/models --seaography - Register the user model in
src/models/mod.rsby addingpub mod user;.
Sources: README.md:77-85, build_tools/scaffold.sh:13-15
Authentication and Access
By default, the admin panel is served at /admin. The backend implements a mock authentication check for demo purposes, which should be replaced by a real RBAC system during customization.
| Credential | Value |
|---|---|
admin@sea-ql.org | |
| Password | demo@sea-ql.org |
| Default Port | 8086 (Loco) or 8000 (Axum Example) |
Sources: README.md:60-64, examples/axum_example/api/src/lib.rs:216-220, examples/axum_example/README.md:14-18
Conclusion
Setting up SeaORM Pro requires configuring the database backend via Cargo features and environment variables, running the seed task for initial data, and deploying the frontend assets through the provided shell scripts. Once the demo is functional, the scaffold.sh tool facilitates the transition to a custom implementation by purging demo-specific entities and configurations.