multi-tenant-node-app
multi-tenant-node-app copied to clipboard
POC of Multi-Tenant REST Application Built on top of NodeJS
multi-tenant-node-app
What is this?
This is a proof-of-concept (POC), multi-tenant RESTful Web Services application built on top of NodeJS.
Get Started
- Install dependencies.
npm install
- Verify the Database configuration in
config/config.json. - Create DB using Sequelize.
npx sequelize-cli db:create
- Run migrations on the main database.
npx sequelize-cli db:migrate
- Start the application.
npm start
- Perform API requests.
APIs
HTTP Headers
- For APIs other than
SignupandAuthentication, pass theJWT Tokenin theAuthorizationheader of the request.
Authorization: Bearer <JWT Token>
- For APIs other than
Signup, pass theTenant IDin theX-TENANT-IDcustom header of the request.
X-TENANT-ID: <Tenant ID>
Signup
- POST
/api/v1/accounts/signup
{
"name": "Alphabet",
"domain": "alphabet.com",
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"password": "5f4dcc3b5aa765d61d8327deb882cf99"
}
Authentication
- POST
/api/v1/auth/login
{
"email": "[email protected]",
"password": "5f4dcc3b5aa765d61d8327deb882cf99"
}
Organizations
-
GET
/api/v1/organizations -
GET
/api/v1/organizations/:organizationId -
POST
/api/v1/organizations
{
"name": "Google",
"domain": "google.com"
}
- DELETE
/api/v1/organizations/:organizationId
Users
-
GET
/api/v1/users -
GET
/api/v1/users/:userId -
POST
/api/v1/users
{
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"password": "5f4dcc3b5aa765d61d8327deb882cf99"
}
- DELETE
/api/v1/users/:userId