Modern cloud-based accounting and ledger system built with Next.js, TypeScript, Tailwind CSS, shadcn/ui, and React Tabler Icons.
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS v4 + shadcn/ui
- Icons: React Tabler Icons (
@tabler/icons-react) - Database: MariaDB (latest) via Docker + phpMyAdmin
# Start MariaDB + phpMyAdmin containers
docker compose up -d| Service | URL | Credentials |
|---|---|---|
| phpMyAdmin | http://localhost:8081 | User: root / Pass: rootpassword |
| MariaDB (host) | localhost:3306 | Database: skyledger_db |
npm install
npm run devOpen http://localhost:3000.
The database/schema.sql file is auto-loaded by MariaDB on first container startup. Tables:
users— First Name, Last Name, Email, Phone, Date of Birth, Password, Roleaccounts— Ledger accounts (Asset, Liability, Equity, Revenue, Expense)transactions— Double-entry journal recordsaudit_logs— Security & audit trail
- Public registration creates standard
useraccounts only (admins cannot self-register). - Login redirects to role-based dashboards:
/admin/dashboard— Administrator console/user/dashboard— Standard user portal
docker compose up -d # Start database + phpMyAdmin
docker compose down # Stop containers
docker compose down -v # Stop & delete volume (reset data)
docker compose logs -f mariadb # View DB logs
docker exec -it skyledger-mariadb mariadb -uroot -prootpassword skyledger_db # SQL shellsrc/
├── app/
│ ├── admin/dashboard/ # Admin dashboard
│ ├── user/dashboard/ # User dashboard
│ ├── api/ # API routes (auth, transactions, admin)
│ ├── login/ # Login page
│ └── register/ # Registration page
├── components/
│ ├── ui/ # shadcn/ui components
│ └── ... # App-specific components
├── context/ # Auth context
└── lib/ # MySQL connection pool & utilities
SkyLedger employs advanced relational database capabilities directly within MariaDB, demonstrating complex SQL functionality in a real-world application:
- Dynamic Migrations:
scripts/setup-db.tsprogrammatically alters the schema usingALTER TABLE, injecting columns dynamically during setup. - Complex Types: The schema uses diverse MySQL data types including
BLOB(for avatars),SET(for preferences),YEAR,DOUBLE(for geospatial lat/lng), andTINYINT(1)boolean flags.
v_flight_search_optimized: A highly optimized Database View pre-joiningflights,airlines,airports, andaircraft. The core search API queries this View instead of executing massive multi-table JOINs in the application layer.
- Data Integrity: An
AFTER UPDATEtrigger on thebookingstable manages audit logs. It also utilizesSIGNAL SQLSTATEto actively intercept and block invalid state transitions (e.g., preventing a cancelled ticket from being un-cancelled).
- Dynamic Pricing: The checkout API (
/api/flights/offer) delegates complex markup/discount calculations to theCalculateDynamicPricingStored Procedure. This procedure usesIN/OUTparameters,IF/ELSEIFflow control, and internal Exception Handlers to apply pricing rules natively in MySQL based on the flight's load factor.
- UNION ALL: The global search bar unifies queries across airlines, airports, and cities into a single dataset.
- Anti-Joins: Admin dashboards use
LEFT JOIN ... WHERE ... IS NULLto identify inactive users. - HAVING & Aggregates: Metrics dashboards utilize grouped queries paired with
HAVING,MAX(), andAVG()filters to determine "Top Airlines". - Correlated Subqueries: Flight searches utilize correlated subqueries to dynamically detect if a specific flight's price is a "Great Deal" compared to the historical average for that specific route.
- TCL (
SAVEPOINT): Multi-passenger ticket issuance is guarded bySAVEPOINTandROLLBACK TO SAVEPOINT, ensuring robust failure recovery during complex database transactions.