AcadHydra is a full-stack academic operations prototype for managing the core workflows around terms, courses, sections, enrollment, attendance, grades, requests, announcements, and audit activity.
The repository contains a Rust API and a Next.js web client. It is designed to run locally against PostgreSQL, with synthetic seed data for demos and repeatable development.
- Role-aware workflows for administrators, registrars, teachers, and students.
- Rust, Axum, Tokio, SQLx, and PostgreSQL on the backend.
- Next.js 16 App Router, TypeScript, and shadcn/ui-style Radix primitives on the frontend.
- JWT authentication with Argon2 password hashing and scoped instructor checks.
- CRUD flows for academic structures, enrollment, announcements, attendance, and grades.
- CSV import/export endpoints and an OpenAPI/Swagger UI at
/docs. - English and Chinese interface labels.
- Minimal and larger deterministic synthetic seed modes for local demos.
backend/ Rust API, migrations, and SQLx offline metadata
web/ Next.js web client
backend/migrations/ PostgreSQL schema migration
- Rust stable with edition 2024 support
- Node.js 20 or newer
- pnpm 10 or newer
- PostgreSQL 14 or newer
-
Create a disposable PostgreSQL database and enable
pgcrypto, which provides the UUID defaults used by the schema.CREATE EXTENSION IF NOT EXISTS pgcrypto;
-
Create local configuration files from the checked-in templates.
cp backend/.env.example backend/.env cp web/.env.example web/.env.local
Set
DATABASE_URLandJWT_SECRETinbackend/.env. Keep both local; never commit either file. -
Apply the schema. The
sqlxCLI is only needed for migrations.cargo install sqlx-cli --no-default-features --features rustls,postgres cd backend sqlx migrate run -
Start the API in a second terminal.
cd backend SQLX_OFFLINE=true cargo runThe API listens on
http://localhost:8080by default. Health checks are available at/healthand/ready; interactive API documentation is available at/docs. -
Install and start the web client.
cd web pnpm install --frozen-lockfile pnpm devOpen
http://localhost:3000.
| Variable | Component | Purpose |
|---|---|---|
DATABASE_URL |
API | PostgreSQL connection string |
JWT_SECRET |
API | Signing key for application tokens |
HOST |
API | Bind address, default 0.0.0.0 |
PORT |
API | Listen port, default 8080 |
ADMIN_EMAIL |
API | Optional administrator bootstrap account |
ADMIN_PASSWORD |
API | Password for the bootstrap account |
ADMIN_NAME |
API | Display name for the bootstrap account |
SEED |
API | Run the small synthetic dataset on startup when true |
SEED_MASSIVE |
API | Run the larger synthetic dataset on startup when true |
NEXT_PUBLIC_API_BASE |
Web | API origin, usually http://localhost:8080 |
For a local demo, set SEED=true after applying the migration. Use SEED_MASSIVE=true only with a disposable database because it creates a substantially larger synthetic dataset.
The API is grouped into:
/api/auth/*for login, registration, profile, refresh, and logout./api/v1/terms,/courses,/sections, and/enrollmentsfor academic structures./api/v1/attendance,/grades, and/final-gradesfor teaching records./api/v1/announcementsand/api/v1/requestsfor communication and approval workflows./api/importand/api/exportfor CSV-oriented data exchange.
The generated OpenAPI document is served at /api-docs/openapi.json and rendered through Swagger UI at /docs.
Run the focused checks from the repository root:
cargo fmt --manifest-path backend/Cargo.toml -- --check
SQLX_OFFLINE=true cargo test --manifest-path backend/Cargo.toml
pnpm --dir web install --frozen-lockfile
pnpm --dir web lint
pnpm --dir web buildSQLx query metadata is checked in under backend/.sqlx, so Rust compilation and tests do not require a live database connection. Runtime API checks still require PostgreSQL.
This is a local-first prototype, not a production deployment blueprint. Before exposing it publicly, review CORS, rate limiting, token storage, database permissions, migration operations, audit retention, and secret management. Seed accounts and passwords are synthetic demo data only and must not be reused in a real environment.
Released under the MIT License.