Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WorkwiseWeb πŸš€

Python FastAPI SQLite Argon2 License: Unlicense

WorkwiseWeb is the backend API for a professional networking and job-seeking application. Built with FastAPI, it provides a comprehensive set of features for user management, profile customization, job searching, and union membership tracking. The API is designed to be robust and scalable, utilizing a SQLite database for data persistence and Argon2 for secure password hashing.

πŸ“± It is the backend for Workwise, the native Android client. That app talks to every endpoint below.

πŸ”Œ The API

Eighteen endpoints across auth, profiles, CVs, qualifications, stats, saved jobs, unions and chat, all documented automatically at /docs:

Generated OpenAPI documentation for the Workwise API

Features ✨

  • πŸ” Secure Authentication: User registration, login, and password reset functionality using email verification codes. Passwords are securely hashed with Argon2.
  • πŸ‘€ User Profile Management: Full CRUD capabilities for user profiles, including personal details, bio, contact information, and location.
  • πŸ“ File Uploads: Supports uploading and managing user profile images and CVs (PDF, DOC, DOCX). Files are stored on the server's filesystem.
  • πŸ“„ CV & Qualification Management: Users can upload multiple CVs, set a primary one, and manage their educational and professional qualifications.
  • πŸ’Ό Job & Application Tracking: View job listings, save interesting jobs, and track statistics like the number of saved jobs and applications.
  • 🀝 Union & Membership Management: Functionality to create and list trade unions, as well as manage worker memberships within those unions.
  • πŸ”‘ Token-Based API Security: Endpoints are protected using a static token-based authentication via the X-Endpoint-Token header.

Technology Stack πŸ› οΈ

  • Backend: Python, FastAPI
  • Web Server: Uvicorn
  • Database: SQLite
  • Password Hashing: Argon2 (passlib)
  • Data Validation: Pydantic
  • Dependencies: python-multipart, jinja2

Getting Started 🏁

Follow these instructions to get a local copy up and running for development and testing purposes.

Prerequisites πŸ“‹

  • Python 3.8+
  • A virtual environment tool (e.g., venv)

Installation & Running ⚑

  1. Clone the repository:

    git clone https://github.com/nevvyboi/workwiseweb.git
    cd workwiseweb/Src
  2. Create and activate a virtual environment:

    • On macOS/Linux:
      python3 -m venv venv
      source venv/bin/activate
    • On Windows:
      python -m venv venv
      .\venv\Scripts\activate
  3. Install the required dependencies:

    pip install -r requirements.txt
  4. Set the endpoint token: Every protected route is guarded by one shared secret, read from the environment. Generate one and export it:

    export WORKWISE_ENDPOINT_TOKEN="$(python -c 'import secrets; print(secrets.token_urlsafe(24))')"

    Leave it unset and the app generates a throwaway token at startup and prints it, so a fresh clone runs immediately. That value changes on every restart, so set it properly for anything beyond local poking. No token is stored in this repository.

  5. Run the application:

    uvicorn main:app --reload

    The API will be available at http://127.0.0.1:8000. You can access the interactive API documentation at http://127.0.0.1:8000/docs.

API Usage πŸ”Œ

All API endpoints are protected and require an X-Endpoint-Token header carrying the value of WORKWISE_ENDPOINT_TOKEN.

Example: Register a New User πŸ“

curl -X POST "http://127.0.0.1:8000/v1/workwise/account" \
-H "Content-Type: application/json" \
-H "X-Endpoint-Token: $WORKWISE_ENDPOINT_TOKEN" \
-d '{
  "username": "newuser",
  "email": "newuser@example.com",
  "password": "a-strong-password"
}'

⚠️ One shared token is a gate, not authentication. It ships inside the Android client, so treat it as a way to keep casual traffic off the API rather than as per user security.

Main Endpoint Categories πŸ“Š

The API is organized into the following categories, visible in the /docs:

  • πŸ” auth: User registration, login, and password management.
  • πŸ‘€ profile: CRUD for user profiles and image uploads.
  • πŸ“„ cv: CV listing, uploading, and management.
  • πŸŽ“ qualifications: CRUD for user qualifications.
  • πŸ“ˆ stats: User activity statistics.
  • πŸ’Ό saved_jobs: Saving and managing jobs.
  • πŸ” jobs: Public endpoints for listing and viewing jobs.
  • 🀝 unions: Creating and listing trade unions.
  • πŸ‘₯ union_members: Managing memberships in unions.

Database πŸ’Ύ

The application uses SQLite as its database. The database file, databaseWorkwise.db, is automatically created in the Src/ directory upon the first run of the application. The necessary tables are also created and initialized by Database/db.py.

The database schema includes tables for:

  • users πŸ‘₯
  • cvs πŸ“„
  • qualifications πŸŽ“
  • job_applications πŸ“‹
  • saved_jobs πŸ’Ό
  • jobs πŸ”
  • unions 🀝
  • union_members πŸ‘₯
  • password_reset_tokens πŸ”‘

License πŸ“„

This project is released into the public domain under The Unlicense. See the LICENSE file for more details.

About

πŸš€ FastAPI backend powering the Workwise Android app πŸ” Argon2 auth with email reset codes, profile & CV management πŸ“„, job search, saved jobs πŸ’Ό and union membership. SQLite-backed REST API.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages