8000 GitHub - mmaous/job-api
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

mmaous/job-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Job Posting API – HRflow.ai Tech Test

This is a simple RESTful API built with FastAPI and PostgreSQL, created as part of a technical test for HRflow.ai. The goal was to build a clean and functional job posting platform backend with user authentication and basic job management.


🔧 Tech Stack

  • Python 3.11
  • FastAPI – web framework
  • SQLAlchemy – ORM
  • PostgreSQL – relational database
  • JWT (PyJWT) – for authentication
  • passlib[bcrypt] – for password hashing
  • Pydantic – for data validation
  • Pytest – for unit testing

Project Structure

app/
├── api/                 # API routes
│   └── v1/
│       ├── auth.py      # Auth endpoints (register/login)
│       └── job.py       # Job CRUD endpoints
├── crud/                # DB logic (get, create, update)
├── auth/                # ha
├── models/
├── schemas/             # Pydantic schemas (request/response)
├── utils/               # Utility functions (none atm)
├── dependencies.py      # Dependency overrides (used for testing)
├── database.py          # DB connection & session
└── main.py              # FastAPI app init and router setup
tests/


Authentication

  • Users can register with a username + password.
  • Passwords are hashed using bcrypt before saving to the database.
  • Users log in using OAuth2 form data, and get a JWT token on success.
  • Auth-protected endpoints check this token to authorize access.

Job Features

  • Users can create, read, update, delete jobs.
  • Each job has a title, description, owner, status, and timestamp.
  • There's support for listing jobs with optional filtering by status or keyword.

Testing

  • All tests use SQLite (in-memory) so the real DB isn’t touched.
  • Authentication and job features have their own test files.
  • The DB session is overridden during tests so it's completely isolated.

Run the Project

  1. Install dependencies:

    pip install -r requirements.txt
  2. Set up PostgreSQL and .env:

    DATABASE_URL=postgresql://user:password@localhost:5432/hrflowai
    
  3. Run the app:

    uvicorn app.main:app --reload
  4. Access the docs at: http://localhost:8000/docs


Notes

  • I focused on keeping the code simple, readable, and modular.
  • This was my first time building a Python/FastAPI backend, so I focused on learning the flow end-to-end.
  • Code is decoupled, and every component is separated logically (routes, models, DB, utils).
  • I also added helpful comments and chose names that make the code self-explanatory.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0