Skip to content

neidigsi/simonneidig_fastapi

Repository files navigation

FastAPI Backend of Personal Website

This repository contains the backend for the website https://simon-neidig.eu, built with FastAPI, SQLAlchemy and Alembic.

Goals

The primary goal of this project is to deliver a modern, user-friendly, and maintainable web application for simon-neidig.eu. The following objectives guide the development and architecture of the backend:

  • Modern and lightweight api to support frontend interaction
  • Fast response times
  • Support for multiple languages build in from scratch (currently German, English, and French)
  • Easy customization and extensibility
  • Clean and developer-friendly documentation, with detailed READMEs throughout the codebase
  • Maintainability and code quality

These goals collectively ensure that the backend not only meets current needs but is also well-prepared for future enhancements and scaling.

This README provides an entry point and overview for developers working with this repository.

Getting Started

To run the application locally, follow these steps:

  1. Install Python and pip
    Make sure you have the latest patch of version 3 of Python installed.

  2. Install dependencies
    Open your terminal, navigate to the root directory of this repository, and run:

    pip install -r requirements.txt
    
  3. Set up database In order to launch the api, a database must be available. The easiest way is to set up a docker database by running the following command. Keep in mind to adjust username and password:

    docker run -d \
     --name simonneidig_postgres \
     -e POSTGRES_DB=simonneidig \
     -e POSTGRES_USER=myuser \
     -e POSTGRES_PASSWORD=mypassword \
     -p 127.0.0.1:5432:5432 \
     --restart=always \
     postgres:latest
    
  4. Start the development server
    Launch the application in development mode with:

    uvicorn app.main:app --reload
    
  5. Access the api
    Open your browser and go to http://localhost:8000.

Concepts

A variety of architectural and design concepts have been considered in the implementation of this backend application. The following sections provide an overview of the most important aspects.

Code Structure

The codebase is organized for clarity and scalability. For a detailed overview of the folder structure and architectural decisions, see ./app/README.md.

Multi Language Support

As a freelancer with roots in Germany and based in France, supporting multiple markets is essential. The application currently supports German, English, and French.
For implementation details, see the section "Multi Language Support" in ./app/README.md.

Database Access

Database access in the application is handled via SQLAlchemy. On one side, database models are defined, which are then made available to the application through queries. Detailed documentation can be found in the two linked subdirectories.

If a database model is changed, database changesets for migrations can be automatically generated using Alembic. For details, refer to the documentation at ./app/db/alembic/README.md.

Testing

Testing plays an important role in ensuring the high quality of the software. At the current stage, the focus is primarily on black-box API testing using Postman. For details on how this works, see the documentation at ./.postman/README.md.

At a later stage of development, more unit tests will be introduced.

Specification

The backend specification is provided in OpenAPI 3 format to enable frontend integration. The approach used is code-first, meaning the OpenAPI specification is generated from the code rather than the other way around. The specification can be found at ./specs/openapi.json in the repository and is automatically generated by running the script ./scripts/generate_openapi.py while the application is running locally.

About

This repository contains the backend of my personal website. It provides the frontend with a REST API and is written in Python using FastAPI as framework.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages