2.0 KiB
2.0 KiB
Server Setup and Run Instructions
This is a Node.js server built with Hono framework, using SQLite database with Drizzle ORM.
Prerequisites
- Node.js (version 18 or higher)
- npm or yarn package manager
Initial Setup
1. Install Dependencies
cd server
npm install
2. Environment Configuration
The server uses a .env file for configuration. The current setup uses:
DB_FILE_NAME=file:./src/db/local.db
This is already configured and will create a local SQLite database file.
3. Database Setup
Generate Database Schema
npm run db:generate
Push Schema to Database
npm run db:push
Seed Database with Sample Data
npm run db:seed
This will create sample users, tasks, and comments using faker.js.
Available Scripts
npm run dev- Start development server with hot reloadnpm run db:push- Push schema changes to databasenpm run db:generate- Generate database migrationsnpm run db:migrate- Run database migrationsnpm run db:reset- Reset database (careful - this will delete all data)npm run db:seed- Seed database with sample data
Running the Server
Development Mode
npm run dev
The server will start on http://localhost:3000
API Endpoints
The server provides the following API routes:
/users- User management endpoints/tasks- Task management endpoints/comments- Comment management endpoints
Database
The server uses SQLite with Drizzle ORM. The database file is stored at ./src/db/local.db and will be created automatically when you run the setup commands.
Technology Stack
- Framework: Hono.js
- Database: SQLite
- ORM: Drizzle ORM
- Runtime: Node.js
- Development: tsx for TypeScript execution
Troubleshooting
- Database issues: Run
npm run db:resetand thennpm run db:pushfollowed bynpm run db:seed - Port conflicts: The server runs on port 3000 by default
- Dependencies: Make sure all dependencies are installed with
npm install