https://github.com/app-generator/api-server-flask-mongo
Flask API Server - FlaskRestX / SQLite / MongoDB | AppSeed
https://github.com/app-generator/api-server-flask-mongo
api-rest appseed appseed-sample flask
Last synced: about 2 months ago
JSON representation
Flask API Server - FlaskRestX / SQLite / MongoDB | AppSeed
- Host: GitHub
- URL: https://github.com/app-generator/api-server-flask-mongo
- Owner: app-generator
- License: other
- Created: 2021-08-21T06:32:02.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-12-01T16:16:38.000Z (over 3 years ago)
- Last Synced: 2025-10-07T18:49:21.283Z (8 months ago)
- Topics: api-rest, appseed, appseed-sample, flask
- Language: Python
- Homepage: https://appseed.us/boilerplate-code/
- Size: 31.3 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
## [Flask API Server - Mongo](https://github.com/app-generator/api-server-flask-mongo)
Flask Starter with JWT authentication, and **SQLite** persistance - Provided by **AppSeed** [App Generator](https://appseed.us/app-generator).
It has all the ready-to-use bare minimum essentials.
> Features:
- ✅ `Up-to-date dependencies`
- ✅ [API Definition](https://docs.appseed.us/boilerplate-code/api-unified-definition) - the unified API structure implemented by this server
- ✅ Simple JWT API powered by `flask-restx` and `flask_jwt_extended`
- ✅ Authentication with JWT (JWT login, JWT logout, Register)
- ✅ **Persistance**: `MongoDB`
- ✅ Unitary tests, Docker
> Can be used with other [React Starters](https://appseed.us/apps/react) for a complete **Full-Stack** experience:
| [React Node JS Berry](https://appseed.us/product/berry-dashboard/api-server-nodejs/react/) | [React Node Soft Dashboard](https://appseed.us/product/soft-ui-dashboard/api-server-nodejs/react/) | [React Node Horizon](https://appseed.us/product/horizon-ui/api-server-nodejs/) |
| --- | --- | --- |
| [](https://appseed.us/product/berry-dashboard/api-server-nodejs/react/) | [](https://appseed.us/product/soft-ui-dashboard/api-server-nodejs/react/) | [](https://appseed.us/product/horizon-ui/api-server-nodejs/)

## Table of Contents
1. [Getting Started](#getting-started)
2. [Project Structure](#project-structure)
3. [Modules](#modules)
4. [Testing](#testing)
## Getting Started
clone the project
```bash
$ git clone https://github.com/app-generator/api-server-flask-mongo.git
$ cd api-server-flask-mongo
```
create virtual environment using python3 and activate it (keep it outside our project directory)
```bash
$ python3 -m venv /path/to/your/virtual/environment
$ source /bin/activate
```
install dependencies in virtualenv
```bash
$ pip install -r requirements.txt
```
setup `flask` command for our app
```bash
$ export FLASK_APP=run.py
$ export FLASK_ENV=development
```
> Or for Windows-based systems
```powershell
$ (Windows CMD) set FLASK_APP=run.py
$ (Windows CMD) set FLASK_ENV=development
$
$ (Powershell) $env:FLASK_APP = ".\run.py"
$ (Powershell) $env:FLASK_ENV = "development"
```
start test APIs server at `localhost:5000`
```bash
$ python run.py
```
or
```bash
$ flask run
```
use `flask-restx`' swagger dashboard to test APIs, or use `POSTMAN`
## Project Structure
```bash
api-server-flask/
├── api
│ ├── config.py
│ ├── __init__.py
│ ├── models.py
│ └── routes.py
├── Dockerfile
├── README.md
├── requirements.txt
├── run.py
└── tests.py
```
## Docker
Our docker image details are in `Dockerfile`
To build the docker image (replace app name between `< >` as per your requirment)
```bash
$ docker build -t :latest .
```
To run the docker container
```bash
$ docker run -d -p 5000:5000
```
## Modules
This application uses the following modules
- Flask==1.1.4
- flask-restx==0.4.0
- Flask-JWT-Extended
- flask-mongoengine
- pytest
## Testing
Run tests using `pytest tests.py`
---
[Flask API Server - Mongo](https://github.com/app-generator/api-server-flask-mongo) - provided by AppSeed [App Generator](https://appseed.us)