A RESTful API server for managing job applications, companies, and contacts.
- Node.js (v18 or higher)
- pnpm (v10.13.1 or compatible)
- SQLite3 (included with better-sqlite3)
- Install dependencies:
pnpm install- (Optional) Create a
.envfile in the project root:
PORT=3000
DATABASE_PATH=./data/database.dbThe server automatically runs migrations on startup. To manually manage the database:
# Run all pending migrations
pnpm run migrate
# Run migrations up
pnpm run migrate:up
# Run migrations down (rollback)
pnpm run migrate:down
# Check migration status
pnpm run migrate:status
# Create a new migration
pnpm run migrate:create
# Reset database (WARNING: deletes all data)
pnpm run migrate:reset
# Validate migrations
pnpm run migrate:validate# Seed the database with sample data
pnpm run seed# Delete database and recreate with migrations + seed data
pnpm run db:reset# Run with auto-reload on file changes
pnpm run watch
# Or run once
pnpm run dev# Build TypeScript
pnpm run build
# Start the server
pnpm startThe server will start on http://localhost:3000 (or the port specified in PORT environment variable).
GET /healthGET /Returns API information and available endpoints.
GET /applications- List all job applicationsGET /applications/:id- Get a specific applicationPOST /applications- Create a new applicationPUT /applications/:id- Update an applicationPATCH /applications/:id- Partially update an applicationDELETE /applications/:id- Delete an application
GET /companies- List all companiesGET /companies/:id- Get a specific companyPOST /companies- Create a new companyPUT /companies/:id- Update a companyPATCH /companies/:id- Partially update a companyDELETE /companies/:id- Delete a company
GET /contacts- List all contactsGET /contacts/:id- Get a specific contactPOST /contacts- Create a new contactPUT /contacts/:id- Update a contactPATCH /contacts/:id- Partially update a contactDELETE /contacts/:id- Delete a contact
The API requires authentication for all endpoints. Currently, the authentication system supports:
For testing purposes, you can use the user-id header:
curl -H "user-id: 1" http://localhost:3000/companiescurl -H "Authorization: Bearer <your-jwt-token>" http://localhost:3000/companies# Via cookie
curl -H "Cookie: session-id=<session-id>" http://localhost:3000/companies
# Via header (for testing)
curl -H "x-session-id: <session-id>" http://localhost:3000/companiesNote: The current authentication implementation includes placeholder/testing code. For production use, implement proper JWT verification and session management.
job-tracker/
├── src/
│ ├── database/ # Database connection, migrations, repositories
│ ├── middleware/ # Express middleware (auth, error handling)
│ ├── routes/ # API route handlers
│ ├── utils/ # Utility functions
│ ├── validation/ # Input validation
│ └── index.ts # Server entry point
├── migrations/ # SQL migration files
├── data/ # Database file location
├── dist/ # Compiled JavaScript (after build)
└── package.json
pnpm run dev- Run server in development modepnpm run watch- Run server with auto-reloadpnpm run build- Compile TypeScript to JavaScriptpnpm start- Run compiled serverpnpm run migrate- Run database migrationspnpm run seed- Seed database with sample datapnpm run db:reset- Reset database (delete + migrate + seed)
The project uses TypeScript with strict type checking. Configuration is in tsconfig.json.
- Ensure the
data/directory exists and is writable - Check
DATABASE_PATHenvironment variable if using custom path - Verify SQLite3 is properly installed
- Change the
PORTenvironment variable - Or stop the process using port 3000
- Check migration files in
migrations/directory - Use
pnpm run migrate:statusto see current state - Use
pnpm run migrate:validateto check for issues
ISC