1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { cors } from "https://esm.sh/hono@3.11.7/cors";
3import { runMigrations } from "./database/migrations";
4import authRoutes from "./routes/auth";
5import kycRoutes from "./routes/kyc";
7import staticRoutes from "./routes/static";
8
9// Initialize database
10await runMigrations();
11
6 getAccountsByUserId,
7 getUserById
8} from "../database/queries";
9import { createApiResponse, generateAccountNumber } from "../../shared/utils";
10import {
2import { jwt } from "https://esm.sh/hono@3.11.7/jwt";
3import { blob } from "https://esm.town/v/std/blob";
4import { createKYCData, getKYCDataByUserId, updateKYCStatus, updateUserKYCStatus } from "../database/queries";
5import { createApiResponse } from "../../shared/utils";
6import { DocumentType, KYCData, KYCStatus, KYCSubmissionResponse } from "../../shared/types";
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { jwt } from "https://esm.sh/hono@3.11.7/jwt";
3import { createUser, getUserByEmail, getUserPasswordHash } from "../database/queries";
4import { createApiResponse, isStrongPassword, isValidEmail } from "../../shared/utils";
5import { AuthResponse, User, UserCredentials, UserRegistration } from "../../shared/types";
64}
65
66// Run this function to reset the database (for development only)
67export async function resetDatabase() {
68 await sqlite.execute(`DROP TABLE IF EXISTS ${ACCOUNTS_TABLE}`);
69 await sqlite.execute(`DROP TABLE IF EXISTS ${KYC_TABLE}`);
16```
17โโโ backend/
18โ โโโ database/
19โ โ โโโ migrations.ts # Schema definitions
20โ โ โโโ queries.ts # DB query functions
49- Backend: Hono (TypeScript)
50- Frontend: React with Tailwind CSS
51- Database: SQLite
52- Authentication: JWT
53- File Storage: Val Town Blob Storage
6
7- `index.ts` - Main entry point for the Hono API server
8- Database tables:
9 - `job_postings` - Stores job listings
10 - `chat_messages` - Stores chat messages
22- `POST /api/chat` - Post a new chat message
23
24## Database Schema
25
26### job_postings
14## Project Structure
15
16- `/backend` - Hono API server and SQLite database
17- `/frontend` - HTML, CSS, and JavaScript for the client-side application
18- `/shared` - Shared types and utilities
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { cors } from "https://esm.sh/hono@3.11.7/middleware";
3import { setupDatabase } from "./database/migrations.ts";
4import jobRoutes from "./routes/jobs.ts";
5import chatRoutes from "./routes/chat.ts";
19app.use("*", cors());
20
21// Setup database on startup
22app.use("*", async (c, next) => {
23 try {
24 await setupDatabase();
25 } catch (error) {
26 console.error("Database setup error:", error);
27 }
28 return next();
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { createChatMessage, getRecentChatMessages } from "../database/queries.ts";
3
4const chat = new Hono();