Giter Site home page Giter Site logo

electorz-backend's Introduction

ElectorZ - Backend

ElectorZ is a political game based on geographical strategies.

This repository hosts the backend of the ElectorZ web application, written in FastAPI. The code of the frontend is available in the Electorz Frontend repository.

Configuration

The entire project configuration is defined in an environment file, of which a template is present in the repository. To bootstrap the configuration, launch the following command:

make .env

You may then modify the following environment variables to configure the ElectorZ backend:

  • APP_HOST: IP address on which the server listens
  • APP_PORT: port on which the server listens
  • FRONTEND_URL: URL of the frontend (to enable CORS)
  • MONGO_HOST: host of the MongoDB instance
  • MONGO_PORT: port on which the MongoDB instance listens
  • MONGO_DB_NAME: name of the MongoDB database
  • MONGO_USERNAME: name of the MongoDB user
  • MONGO_PASSWORD: password of the MongoDB user
  • MONGO_TLS: boolean that indicates if TLS must be enabled to connect to the MongoDB instance
  • MONGO_MAX_CONNECTIONS: maximum number of connections to the MongoDB instance
  • MONGO_MIN_CONNECTIONS: minimum number of connections to the MongoDB instance

Installation

You can install the pip requirements by launching the following command:

make install

MongoDB instance

If you do not have a MongoDB instance available for the ElectorZ application, you can launch a dockerized version of MongoDB by launching the following command:

make stack

It will automatically provision the database with the JSON files present in the db-init directory.

Note that a mongo-express image has been added to the docker-compose file to help you manage the database: it provides a web administration tool available at http://localhost:8081.

Launching the application

Once a MongoDB database is available with the configuration options provided in the environment file, the ElectorZ backend application may be launched with the following command:

make start

Documentation

FastAPI provides automatic documentations thanks to the Swagger & Redoc modules: you can for instance visit http://localhost:8080/docs to get all information about the API and test the routes.

See Also

Contributing to this application

This application started as personal project, but I welcome community contributions to it. If you find problems, please open an issue or create a PR against the ElectorZ Backend repository.

You can also reach me by email at [email protected].

Licensing

Mozilla Public License Version 2.0.

See LICENSE to see the full text.

Author Information

This application was created in 2022 by Justin Béra.

electorz-backend's People

Contributors

just1not2 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.