A RESTful API built in TypeScript, using Express and PostgreSQL, that allows users to manage job applications and track their status through a simple back‑end service.
- Create, read, update, and delete ("CRUD") job applications.
- Store job information in PostgreSQL (company name, role, application date, status, etc.).
- TypeScript for type safety and maintainability.
- Modular architecture: routes, controllers, services, database layer.
- Environment‑based configuration (e.g., database connection string, port).
- Ready to deploy (locally or in a cloud environment).
- Node.js + Express
- TypeScript
- PostgreSQL
- (Optional) Any ORM or query builder if included (check in code)
- Environment variables with
.env
- Node.js (v16+ recommended)
- npm or yarn
- PostgreSQL server running and accessible
- (Optional) Postman or similar tool to test API endpoints
- Clone the repository
git clone https://github.com/Andile45/Job‑Tracker‑API‑with‑Postgres.git cd Job‑Tracker‑API‑with‑Postgres - Install dependencies
npm install # or yarn install - Create a
.envfile in the root directory (you can copy from a sample or.env.exampleif present). Example variables:PORT=5000 DATABASE_URL=postgresql://username:password@localhost:5432/job_tracker_db NODE_ENV=development - Set up the database
- Create a new PostgreSQL database (e.g.,
job_tracker_db). - Run the SQL schema below to create tables.
- Create a new PostgreSQL database (e.g.,
- Start the server
npm run build # if you compile TypeScript npm start # or for development npm run dev
- The API should now be running at
http://localhost:PORT(defaultPORT=5000).
Below are example SQL statements you can use to create the necessary tables:
-- Users table
CREATE TABLE users (
id SERIAL PRIMARY KEY,
email VARCHAR(100) UNIQUE NOT NULL,
password_hash VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Job Applications table
CREATE TABLE applications (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
company_name VARCHAR(100) NOT NULL,
job_title VARCHAR(100) NOT NULL,
status VARCHAR(50) DEFAULT 'Applied',
date_applied DATE DEFAULT CURRENT_DATE,
notes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Optional: trigger to auto-update updated_at column
CREATE OR REPLACE FUNCTION update_modified_column()
RETURNS TRIGGER AS $$
BEGIN
NEW.updated_at = NOW();
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER update_job_timestamp
BEFORE UPDATE ON applications
FOR EACH ROW
EXECUTE FUNCTION update_modified_column();INSERT INTO users (email, password_hash)
VALUES ('test@example.com', 'hashed_password_here');
INSERT INTO applications (user_id, company_name, job_title, status, notes)
VALUES
(1, 'Google', 'Software Engineer', 'Interviewing', 'First round passed'),
(1, 'Amazon', 'Backend Developer', 'Applied', 'Waiting for response');- One-to-many: one user can have many job applications.
- Deleting a user removes all their applications automatically (
ON DELETE CASCADE).
| Method | Path | Description |
|---|---|---|
| GET | /api/jobs |
Get all job applications |
| GET | /api/jobs/:id |
Get a single job application |
| POST | /api/jobs |
Create a new job application |
| PUT | /api/jobs/:id |
Update an existing job application |
| DELETE | /api/jobs/:id |
Delete a job application |
npm run test/src
/controllers
/services
/models
/routes
index.ts
tsconfig.json
package.json
Contributions are welcome!
- Fork the repository
- Create a feature branch (
git checkout -b feature/my‑feature) - Commit your changes (
git commit -m "Add my feature") - Push to your branch (
git push origin feature/my‑feature) - Open a pull request
- Thanks to all contributors and open‑source libraries used.
- Inspired by job tracking tools and REST API best practices.