A backend REST API for managing job listings, built with Django, PostgreSQL, and Redis.
Includes CRUD operations and a stats endpoint with caching support.
- Create, view, update, and delete job listings (
/api/jobs/
) - View total job count (
/api/stats/
) with Redis caching - Built with Django REST Framework
- PostgreSQL database
- Redis cache integration
- Django 5.2.4
- Django REST Framework
- PostgreSQL
- Redis
- Docker (optional for deployment)
git clone https://github.com/Siddharthsinghkumar/jobboard-api.git
cd jobboard-api
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Create a PostgreSQL user and database:
CREATE DATABASE jobdb;
CREATE USER jobuser WITH PASSWORD 'jobpass';
ALTER ROLE jobuser SET client_encoding TO 'utf8';
ALTER ROLE jobuser SET default_transaction_isolation TO 'read committed';
ALTER ROLE jobuser SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE jobdb TO jobuser;
GRANT ALL ON SCHEMA public TO jobuser;
ALTER SCHEMA public OWNER TO jobuser;
ALTER DATABASE jobdb OWNER TO jobuser;
Update jobboard/settings.py
:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'jobdb',
'USER': 'jobuser',
'PASSWORD': 'jobpass',
'HOST': 'localhost',
'PORT': '5432',
}
}
sudo apt install redis-server
sudo systemctl enable redis
sudo systemctl start redis
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
Visit http://127.0.0.1:8000/api/jobs/
to see the API.
Method | Endpoint | Description |
---|---|---|
GET | /api/jobs/ | List all jobs |
POST | /api/jobs/ | Create a new job |
GET | /api/jobs/ | Retrieve job details |
PUT | /api/jobs/ | Update a job |
DELETE | /api/jobs/ | Delete a job |
GET | /api/stats/ | Get total jobs count |
MIT License. Free for personal and educational use.