VagaFlow API is the backend that powers the VagaFlow job platform.
This project was built with a strong focus on architecture and data modeling. The domain is split into clear entities for authentication, candidates, companies, jobs, applications, screening questions, and answers. The goal was to keep the model normalized, role-aware, and easy to extend as the product grows.
- Authentication with JWT
- Role-based access for candidates and companies
- Profile management for both user types
- Job creation, listing, updating, and deletion
- Job application flow
- Company application review
- Job screening questions and application answers
The API follows a simple and explicit structure:
src/routesdefines the HTTP layersrc/controllerscontains request handlerssrc/schemasvalidates input with Zodsrc/middlewareshandles authentication and role checkssrc/lib/prisma.tscentralizes database access
The code is organized by domain instead of by technical layer alone, which makes the product logic easier to understand and maintain.
The data model was one of the main parts of the project.
The core idea is a single User table for authentication, with one-to-one profile tables for each role:
Userstores login data and role informationCandidatestores candidate profile dataCompanystores company profile data
From there, the hiring flow is modeled through:
Jobfor published vacanciesApplicationfor candidate submissionsJobQuestionfor screening questions attached to a jobApplicationAnswerfor answers submitted with an application
This structure keeps authentication separated from profile data and lets the platform grow without turning the schema into a single oversized table.
- Fastify
- TypeScript
- Prisma
- PostgreSQL
- JWT
- Zod
- bcryptjs
Auth:
POST /auth/registerPOST /auth/login
Candidate profile:
GET /candidate/profilePATCH /candidate/profileDELETE /candidate/profile
Company profile:
GET /company/profilePATCH /company/profileDELETE /company/profile
Jobs:
GET /jobsGET /jobs/:idPOST /jobsPATCH /jobs/:idDELETE /jobs/:id
Applications:
POST /applications/:jobIdGET /applicationsGET /applications/companyPATCH /applications/:id
The API uses JWT for authentication and checks access by role.
- Candidates can access candidate-specific routes and apply to jobs
- Companies can manage jobs and review applications
Create a .env file based on the example below:
POSTGRES_DB=vagaflow
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_password_here
POSTGRES_PORT=5432
DATABASE_URL="postgresql://postgres:your_password@localhost:5432/vagaflow?schema=public"
JWT_SECRET=your_secret_here
ALLOWED_ORIGINS=http://localhost:3000
PORT=3333
NODE_ENV=developmentStart PostgreSQL:
docker compose up -dInstall dependencies:
npm installRun Prisma migrations:
npx prisma migrate devStart the API:
npm run devnpm run dev
npm run build
npm run startThis backend was designed to support a real hiring workflow rather than a demo-only flow. The main work here was not just exposing endpoints, but modeling the relationships correctly and keeping the responsibilities separated across auth, profiles, jobs, and applications.