API Server Flask
Open-source API Server crafted in Flask using JWT Authentication and SQLite.
Simple Flask API Starter with JWT authentication, and SQLite persistence that provides "out-of-the-box" all the ready-to-use bare minimum essentials.
Product Links
API Methods - for full description please access API Unified Definition​
    USERS API:
      /api/users/register: create a new user
      /api/users/login: authenticate an existing user
      /api/users/logout: delete the associated JWT token
      /api/users/checkSession: check an existing JWT Token for validity
      /api/users/edit - edit the information associated with a registered user
Flask API Server - Open-source Product.

Requirements β€Œ

    Python3 (Python2 is not supported)
    Flask==1.1.4
    flask-restx==0.4.0
    Flask-JWT-Extended==4.2.3
    pytest

​

Getting Started

Step #1 - clone the project using GIT
1
$ git clone https://github.com/app-generator/api-server-flask.git
2
$ cd api-server-flask
Copied!
Step #2 - Install dependencies (using a virtual environment)
1
$ python3 -m venv /path/to/your/virtual/environment
2
$ source <path/to/venv>/bin/activate
Copied!
Install dependencies in once the virtualenv is activated
1
$ pip install -r requirements.txt
Copied!
Step #3 - Prepare the environment
1
$ export FLASK_APP=run.py
2
$ export FLASK_ENV=development
Copied!
Or for Windows-based systems
1
$ (Windows CMD) set FLASK_APP=run.py
2
$ (Windows CMD) set FLASK_ENV=development
3
$
4
$ (Powershell) $env:FLASK_APP = ".\run.py"
5
$ (Powershell) $env:FLASK_ENV = "development"
Copied!
Step #4 - Initialize the database, check run.py for shell context
1
$ flask shell
2
>>> from api import db
3
>>> db.create_all()
Copied!
Step #5 - Start the API server
1
$ python run.py
2
// OR
3
$ flask run
Copied!
Visit http://localhost:5000 in your browser. The API server will be running.
​

Project Structure

The codebase has a simple, intuitive structure where run.py is responsible to bundle and start the API Server using the setup coded by the api folder:
1
api-server-flask/
2
β”œβ”€β”€ api
3
β”‚ β”œβ”€β”€ config.py
4
β”‚ β”œβ”€β”€ __init__.py
5
β”‚ β”œβ”€β”€ models.py
6
β”‚ └── routes.py
7
β”œβ”€β”€ Dockerfile
8
β”œβ”€β”€ README.md
9
β”œβ”€β”€ requirements.txt
10
β”œβ”€β”€ run.py
11
└── tests.py
Copied!

​

Compatible Fullstack Products

The product can be used as a standalone server but also as an authentication server for React, Vue products. Such a product already configured with Django API Server is React Datta Able, an open-source React Dashboard.
React Datta Able - Open-Source Dashboard.
Last modified 2mo ago