1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { runMigrations } from "./database/migrations.ts";
4import auth from "./routes/auth.ts";
5import students from "./routes/students.ts";
13});
14
15// Initialize database on startup
16await runMigrations();
17
6 markMessageAsRead,
7 getDashboardStats
8} from "../database/queries.ts";
9import type { CreateMessageRequest, ApiResponse, Message, DashboardStats } from "../../shared/types.ts";
10
7 updateStudent,
8 deleteStudent
9} from "../database/queries.ts";
10import type { CreateStudentRequest, ApiResponse, Student } from "../../shared/types.ts";
11
2import { getCookie, setCookie, deleteCookie } from "https://esm.sh/hono@3.11.7/cookie";
3import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
4import { getUserByUsername, validateUserPassword, getUserById } from "../database/queries.ts";
5import type { LoginRequest, ApiResponse, User } from "../../shared/types.ts";
6
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2
3// Database schema setup for the school management system
4export async function runMigrations() {
5 console.log("Running database migrations...");
6
7 // Users table - for authentication and role management
95 }
96
97 console.log("Database migrations completed successfully!");
98}
99
100// Helper function to reset database (for development)
101export async function resetDatabase() {
102 console.log("Resetting database...");
103
104 await sqlite.execute("DROP TABLE IF EXISTS user_sessions");
108
109 await runMigrations();
110 console.log("Database reset completed!");
111}
26```
27โโโ backend/
28โ โโโ database/
29โ โ โโโ migrations.ts # Database schema setup
30โ โ โโโ queries.ts # Database query functions
31โ โโโ routes/
32โ โ โโโ students.ts # Student CRUD operations
50
51- **Backend**: Hono (TypeScript API framework)
52- **Database**: SQLite (Val Town hosted)
53- **Frontend**: React with TypeScript
54- **Styling**: TailwindCSS
57## Getting Started
58
591. The app will automatically set up the database on first run
602. Access the application through the HTTP endpoint
613. Default admin credentials will be created for initial setup
16```
17โโโ backend/
18โ โโโ database/
19โ โ โโโ migrations.ts # Database schema setup
20โ โ โโโ queries.ts # Database query functions
21โ โโโ routes/
22โ โ โโโ auth.ts # Authentication routes
77
78### Technical Features
79- SQLite database with proper schema design
80- RESTful API endpoints
81- Session-based authentication
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { runMigrations } from "./database/migrations.ts";
4import auth from "./routes/auth.ts";
5import tasks from "./routes/tasks.ts";
12});
13
14// Initialize database
15await runMigrations();
16
8 updateTaskCompletion,
9 deleteTask
10} from "../database/queries.ts";
11
12const tasks = new Hono();
10 getSessionByToken,
11 deleteSession
12} from "../database/queries.ts";
13
14const auth = new Hono();