- Uses Pipenv for managing dependencies
- Built on top of Flask, using a couple of other open-source libraries (see Pipfile for complete list)
- Uses MongoDB for database operations related to user management. Plugging in other database systems (MySQL, SQL Server etc.) for business logic should be straightforward.
- Provides services for sending mails via SendGrid
- Provides services for uploading files to AWS cloud buckets
- Uses JWT for tokens
- Provides out of the box APIs for user management (including roles)
- Sets up common decorators for role/claim based access
- Comes with Pytest test suite (Work in progress. Apologies!) for the API layer. I recommend that you write test cases for your project and preferably, cover all the modules. Remember that in the long run, unit tests save time, money & your precious mental sanity.
The following collections are a part of this boilerplate:
- users -- contains the basic information for the registered user. Name etc. are stored separately in user profile.
- passwordResetTokens
- userProfiles
- claimsManagement
The database design is quite straightforward. All the collection related constants (and a couple of other constants) are defined in constants.py
. That should be the first stop in case you need to understand what's going on in the DB layer.
- JWT_SECRET_KEY
- MONGODB_URI
- SENDGRID_API_KEY
The next set of env variables is for accessing AWS services but configured via the Heroku CloudCube add-on
- CLOUDCUBE_ACCESS_KEY_ID
- CLOUDCUBE_SECRET_ACCESS_KEY
- CLOUDCUBE_URL
- File
app.py
, methodcreate_app()
, setup the correct set of CORS options
- File
app.py
, methodcreate_app()
, setup the required value forapp.config["MAX_CONTENT_LENGTH"]
Invoking pytest
on the command line will run the test cases in order. The test suite expects setup_env.py
to be a part of tests->functional
package. This file can be used to set the env variables before starting the tests. Care must be taken to ensure that you do not check-in any secret keys to your source control repository.
You'll need to run a MongoDB instance to execute the test cases locally.
While this project can be deployed just like any standard python application, you might find certain files such as Procfile
and runtime.txt
which are specific to Heroku based deployments
Preet Kamal Singh Minhas, MarchingBytes Technology Solutions (OPC) Pvt. Ltd.
MIT. For details, refer to LICENSE file.
If this project helped you in any way, star the repository on github.