ποΈ Add Backend Apps
You can use different backend frameworks such as NestJS, ExpressJS, Laravel, Spring Boot, and others.
π Guidelinesβ
- You can name your backend application(s) with relevant names, like:
- Examples:
nestjs-appfor NestJSlaravel-appfor Laravelexpressjs-appfor ExpressJSspringboot-appfor Spring Boot
- Examples:
- For multiple backend applications, create separate folders inside the
apps/directory with relevant names, like:nest-dashboard-applaravel-auth-appspringboot-service-app
Make sure to follow the structure and naming conventions consistently for better maintainability.
π Quick Start: Adding Backend Frameworksβ
You can follow the detailed documentation provided in this workspace to integrate your preferred backend framework seamlessly.
π Adding Backend Applications to Your Workspaceβ
We provide boilerplates for various backend frameworks to make your integration process smoother. You can download and add these frameworks to your workspace apps/ folder.
π Available Backend Boilerplatesβ
- NestJS: Download NestJS Boilerplate
- Laravel: To be added
- ExpressJS: To be added
- Spring Boot: To be added
Note: Download the repositories as a ZIP file to avoid git reference issues.
π οΈ Updating tsconfig.jsonβ
Ensure that your tsconfig.json in each app extends the base tsconfig from the workspace level for a unified setup.
Example:
{
"extends": "../../tsconfig.base.json", // Use the correct relative path
"compilerOptions": {
// Your existing options
}
}
π§ Updating package.json Scriptsβ
To manage the backend apps easily, update the workspace-level package.json scripts with your actual application names.
Example:
{
"docker:up": "npm run db:dev:up --workspace=nestjs-app", // Replace 'nestjs-app' with your app name
"nestjs:dev": "npm run start:dev --workspace=nestjs-app", // Replace 'nestjs-app' with your app name
"laravel:start": "npm run start --workspace=laravel-app" // Replace 'laravel-app' with your app name
}
Note: Application name is present in
package.jsonof your backedn application (It's not the folder-name)
π Configuring project.jsonβ
- Ensure that each backend application has its own
project.jsonfile configured with necessary scripts and settings. - This will allow you to leverage Nx for running your applications effectively from the workspace level.
π Running Your Backend Applicationsβ
Once you've added your backend applications to the workspace, follow these steps to run them:
-
Install Dependencies: Make sure you are in the workspace (root) level and run:
$ yarn install
// or
$ npm install -
Start Docker Services: Run the Docker services needed for your backend by executing:
npm run docker:up -
Provide Necessary Permissions (If you face permission issues): If you encounter permission errors, run the following command to grant necessary permissions:
sudo chmod -R 777 /{path-to-project-repo}/data/prometheus -
Start the Backend Service: Once Docker is up, start your backend service:
npm run nestjs:dev -
Access Swagger & GraphQL:
- Swagger Docs: Accessible at
{BASE_URL}/api - GraphQL Playground: Accessible at
{BASE_URL}/graphql
- Swagger Docs: Accessible at
Replace
{BASE_URL}with your applicationβs running URL (e.g.,http://localhost:3000).
Now your backend apps should be up and running! π