✨ Your new, shiny Nx workspace is ready ✨.
Learn more about this workspace setup and its capabilities or run npx nx graph to visually explore what was created. Now, let's get you up to speed!
- Node.js (v18+)
- Docker and Docker Compose
- npm
# Start everything (MongoDB + API + Frontend)
npm start
# Or step by step:
npm run docker:up # Start MongoDB container
npm run dev # Start both API and Frontend servicesThis will start:
- MongoDB: Running on
localhost:27017(with authentication) - API Service: Running on
localhost:3000 - Frontend: Running on
localhost:4200
# Start just the API service
npx nx serve api-service
# Start just the frontend
npx nx serve frontend-web
# Build both projects
npm run build# Start MongoDB container
npm run docker:up
# Stop and remove containers
npm run docker:down
# View MongoDB logs
npm run docker:logs
# Reset MongoDB data (removes all data!)
npm run docker:resetCopy .env.example to .env and configure the following variables:
The API supports configurable CORS origins for cross-origin requests:
CORS_ORIGINS: Comma-separated list of allowed origins (default:http://localhost:4200)- Example:
CORS_ORIGINS=http://localhost:4200,http://localhost:3000,https://yourdomain.com
MONGO_URI: Full MongoDB connection string with authenticationMONGO_HOST: MongoDB host (default: localhost)MONGO_PORT: MongoDB port (default: 27017)MONGO_DB: Database name (default: filament_db)MONGO_USER: Database user (default: filament_user)MONGO_PASSWORD: Database password (default: filament_password)
NODE_ENV: Environment (development/production)PORT: Server port (default: 3000)
The project consists of:
- API Service (
apps/api-service): Fastify-based REST API with MongoDB - Frontend Web (
apps/frontend-web): Next.js application consuming the API - Database: MongoDB running in Docker with authentication
The frontend depends on the API service, ensuring proper build and deployment order.
To run the dev server for your app, use:
npx nx serve api-serviceTo create a production bundle:
npx nx build api-serviceTo see all available targets to run for a project, run:
npx nx show project api-serviceThese targets are either inferred automatically or defined in the project.json or package.json files.
More about running tasks in the docs »
While you could add new projects to your workspace manually, you might want to leverage Nx plugins and their code generation feature.
Use the plugin's generator to create new projects.
To generate a new application, use:
npx nx g @nx/node:app demoTo generate a new library, use:
npx nx g @nx/node:lib mylibYou can use npx nx list to get a list of installed plugins. Then, run npx nx list <plugin-name> to learn about more specific capabilities of a particular plugin. Alternatively, install Nx Console to browse plugins and generators in your IDE.
Learn more about Nx plugins » | Browse the plugin registry »
To connect to Nx Cloud, run the following command:
npx nx connectConnecting to Nx Cloud ensures a fast and scalable CI pipeline. It includes features such as:
- Remote caching
- Task distribution across multiple machines
- Automated e2e test splitting
- Task flakiness detection and rerunning
Use the following command to configure a CI workflow for your workspace:
npx nx g ci-workflowNx Console is an editor extension that enriches your developer experience. It lets you run tasks, generate code, and improves code autocompletion in your IDE. It is available for VSCode and IntelliJ.
Learn more:
- Learn more about this workspace setup
- Learn about Nx on CI
- Releasing Packages with Nx release
- What are Nx plugins?
And join the Nx community: