39 `);
40
41 console.log("Database migrations completed");
42}
1# Inventory Management System
2
3A modern inventory management system built with TypeScript, Hono backend, React frontend, and SQLite database.
4
5## Features
15```
16โโโ backend/
17โ โโโ database/
18โ โ โโโ migrations.ts # Database schema setup
19โ โ โโโ queries.ts # Database query functions
20โ โโโ routes/
21โ โ โโโ items.ts # Item management routes
37```
38
39## Database Schema
40
41### Items Table
76
77The application uses:
78- **Backend**: Hono framework with SQLite database
79- **Frontend**: React with TypeScript and TailwindCSS
80- **Styling**: Bootstrap-like styling with TailwindCSS
2
3export async function runMigrations() {
4 console.log("Running database migrations...");
5
6 // Users table
146 }
147
148 console.log("Database migrations completed successfully!");
149}
15
16- **Backend**: TypeScript with Hono framework
17- **Database**: SQLite
18- **Frontend**: HTML, CSS, JavaScript with Bootstrap 5
19- **Authentication**: Session-based authentication
23```
24โโโ backend/
25โ โโโ database/
26โ โ โโโ migrations.ts # Database schema setup
27โ โ โโโ queries.ts # Database query functions
28โ โโโ routes/
29โ โ โโโ auth.ts # Authentication routes
44## Getting Started
45
461. The system will automatically set up the database on first run
472. Default admin credentials: admin@hospital.com / admin123
483. Access the system through the main HTTP endpoint
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 { getMessageTemplates, getContacts, getSettings } from "./database/queries.ts";
5import messages from "./routes/messages.ts";
6import scheduler from "./routes/scheduler.ts";
13});
14
15// Initialize database on startup
16await runMigrations();
17
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import type { ApiResponse } from "../../shared/types.ts";
3import { getPendingMessages, updateMessageStatus, createScheduledMessage } from "../database/queries.ts";
4import { generateWhatsAppUrl, getNextRecurrence } from "../../shared/utils.ts";
5
7 updateMessageStatus,
8 createOrUpdateContact
9} from "../database/queries.ts";
10import { formatPhoneNumber, validatePhoneNumber, isValidFutureDateTime, generateId } from "../../shared/utils.ts";
11
10
11export async function runMigrations() {
12 console.log('Running database migrations...');
13
14 // Scheduled Messages table
67 await insertDefaultSettings();
68
69 console.log('Database migrations completed');
70}
71
25- **Frontend**: React with TypeScript
26- **Backend**: Hono API framework
27- **Database**: SQLite for message storage
28- **Styling**: TailwindCSS
29- **Storage**: Local storage + server backup
34โโโ backend/
35โ โโโ index.ts # Main API server
36โ โโโ database/
37โ โ โโโ migrations.ts # Database schema
38โ โ โโโ queries.ts # Database operations
39โ โโโ routes/
40โ โโโ messages.ts # Message CRUD operations
95- **HTTP-Only Cookies**: Session cookies are not accessible via JavaScript
96- **Token Refresh**: Automatic refresh of expired access tokens
97- **Secure Storage**: Tokens are stored securely in the database
98
99## Troubleshooting