IronLance is a job board platform that connects Ironhack alumni (Ironhackers) with companies offering job opportunities. This is the Backend API built with Express.
- Express.js - Web framework
- MongoDB / Mongoose - Database and ODM
- JSON Web Token (JWT) - Authentication
- Bcrypt - Password hashing
- Cookie Parser - Cookie handling
- CORS - Cross-origin resource sharing
- Morgan - HTTP request logging
- Dotenv - Environment variable management
The frontend for this application is hosted in a separate repository. You can find it here:
git clone https://github.com/CesarDevtools/ironLance-server.git
cd ironlance-servernpm installCreate a .env file in the root directory with the following variables:
# Server
PORT=5000
# Database
MONGODB_URI=mongodb://localhost:27017/ironlance
# Authentication
JWT_SECRET=your-super-secret-jwt-key-change-in-production
# Frontend URL (for CORS)
ORIGIN=http://localhost:5173Database Setup: You need a MongoDB instance running locally or use MongoDB Atlas. If using local MongoDB, make sure it's running before starting the server.
This project includes a seeds.js file that populates the database with sample data for testing purposes.
What the seed creates:
- 3 Companies: Google, Meta, and Amazon (password:
Password123) - 20 Ironhackers: Sample students with profiles (password:
Password123) - 30 Job Listings: Various positions across the companies
To seed the database:
npm run seedNote: Running the seed will delete all existing data and replace it with the sample data.
Test Accounts:
| Role | Password | |
|---|---|---|
| Company | google@google.com |
Password123 |
| Company | meta@meta.com |
Password123 |
| Company | amazon@amazon.com |
Password123 |
| Ironhacker | estudiante1@ironhackers.com |
Password123 |
Development mode (with auto-reload):
npm run devProduction mode:
npm startThe API will be available at http://localhost:5000/api
🌐 API Base URL: https://ironlance-server.vercel.app
The backend is deployed on Vercel alongside the frontend.
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | / |
Health check endpoint | No |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /auth/signup |
Register new user (Ironhacker or Company) | No |
| POST | /auth/login |
Login and receive JWT token | No |
| PUT | /auth/update |
Update user profile and regenerate token | Yes |
| GET | /auth/verify |
Verify current token | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /jobs |
List all active job postings | No |
| GET | /jobs/:id |
Get job details | No |
| POST | /jobs |
Create a new job (Company only) | Yes |
| PUT | /jobs/:id |
Update a job (Owner only) | Yes |
| DELETE | /jobs/:id |
Delete a job and its applications (Owner only) | Yes |
| GET | /my-jobs |
Get company's own job postings | Yes (Company) |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /applications |
Apply to a job (Ironhacker only) | Yes |
| GET | /my-applications |
Get my applications (Ironhacker) | Yes |
| GET | /applications/:id |
Get application details (Company owner) | Yes |
| GET | /jobs/:jobId/applications |
Get applicants for a job (Company owner) | Yes |
| PUT | /applications/:id |
Update application status (Company owner) | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /users/ironhackers |
List public Ironhacker profiles (Company only) | Yes |
| GET | /users/:userId |
Get Ironhacker profile details | Yes |
- Authentication: All protected routes require a JWT token sent via HTTP-only cookie.
- Roles: Users have either
IRONHACKERorCOMPANYrole, determining their access to certain endpoints. - Error Handling: Returns appropriate HTTP status codes (400, 401, 403, 404, 500) with JSON error messages.