ajthr / fastapi-react-mongodb

Full stack web application generator. Using FastAPI, React, MongoDB and Docker.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FastAPI React MongoDB - Base Project Generator

test version

fastapi-logo react-logo     typescript-logo     mongodb-logo

Features

Quick Start

First, install cookiecutter if you don't already have it:

pip3 install cookiecutter

Second, install docker-compose if you don't already have it:

docker-compose installation official docs.

Then, in the directory you want your project to live:

cookiecutter gh:ajthr/fastapi-react-mongodb
Input Variables
  • project_name [default fastapi-react-mongodb]
  • project_slug [default fastapi-react-mongodb] - this is your project directory
  • external_database [default n] - whether to use any external database like mongodb atlas
  • external_db_uri [optional default None] - database uri to connect to external database if using one.
  • mongodb_user [default root]
  • mongodb_password [default password]
  • secret_key [default super_secret]

Develop

Change into your project directory and run:

docker-compose build

This will build and run the docker containers.

It may take a while to build the first time it's run since it needs to fetch all the docker images.

Once you've built the images once, you can simply use regular docker-compose commands to manage your development environment, for example to start your containers:

docker-compose up -d

Once this finishes you can navigate to the localhost port, you should see the slightly modified create-react-app page.

Testing

To run test for the template, run:

chmod +x ./test.sh
./test.sh

To run test for api, run

docker-compose run --rm api sh -c "pytest"

to run test for web, run

docker-compose run --rm web sh -c "npm run test"

About

Full stack web application generator. Using FastAPI, React, MongoDB and Docker.

License:MIT License


Languages

Language:Python 47.6%Language:TypeScript 32.5%Language:Shell 9.1%Language:CSS 6.8%Language:HTML 4.0%