A TypeScript backend API for managing job applications with file uploads, built with Fastify, Prisma, PostgreSQL, and MinIO.
- RESTful API for job application management
- File uploads with MinIO S3-compatible storage
- PostgreSQL database with Prisma ORM
- OpenAPI/Swagger documentation
- TypeScript for type safety
- Zod schemas for validation
POST /api/applications
- Create a new applicationPOST /api/files/upload
- Upload file (applicationId optional)
- Upload files first (optional):
POST /api/files/upload
without applicationId- Files stored in
uploads/unassigned/{fileId}-{filename}
- Browser receives file
id
in response and tracks it
- Files stored in
- Create application:
POST /api/applications
with application data +fileIds
array- Files automatically moved from
uploads/unassigned/
toapplications/{applicationId}/
- Database updated with applicationId link
- Files automatically moved from
- Upload more files (optional):
POST /api/files/upload
with applicationId for direct linking- Files stored directly in
applications/{applicationId}/
folder
- Files stored directly in
Example:
// 1. Upload files and collect IDs
const file1 = await uploadFile(resumeFile); // Returns {id: "file1_id", ...}
const file2 = await uploadFile(coverLetter); // Returns {id: "file2_id", ...}
// 2. Create application with file IDs
const application = await createApplication({
name: "John Doe Application",
description: "Software Engineer Position",
fileIds: [file1.id, file2.id] // Links files to application
});
GET /health
- Health check endpointGET /docs
- Swagger UI documentation
The following endpoints are disabled until proper authentication is implemented:
GET /api/applications- List applicationsGET /api/applications/:id- Get application detailsPUT /api/applications/:id- Update applicationDELETE /api/applications/:id- Delete applicationGET /api/files/:id- Get file metadataGET /api/files/:id/download- Get file download URLDELETE /api/files/:id- Delete file
-
Copy environment variables:
cp .env.example .env
-
Install dependencies:
pnpm install
-
Start local development services (PostgreSQL + MinIO):
docker-compose -f docker-compose.dev.yml up -d
-
Run database migrations:
pnpm db:migrate
-
Start development server:
pnpm dev
The start
script automatically applies migrations on startup:
pnpm start # Runs: prisma migrate deploy && node dist/server.js
The API will be available at http://localhost:3000 and documentation at http://localhost:3000/docs
DATABASE_URL
- PostgreSQL connection stringMINIO_ENDPOINT
- MinIO server endpointMINIO_PORT
- MinIO server portMINIO_ACCESS_KEY
- MinIO access keyMINIO_SECRET_KEY
- MinIO secret keyMINIO_BUCKET
- MinIO bucket namePORT
- Server port (default: 3000)