Welcome to MicroNest! This project showcases the implementation of a micro-frontends architecture using a monorepo setup with NestJS, a progressive Node.js framework.
- Overview
- Project Structure
- Getting Started
- Running the Project
- Adding a New Micro-Frontend
- Adding a New Microservice
- Technologies Used
- Contributing
- License
MicroNest is designed to demonstrate how multiple micro-frontends can be developed, tested, and deployed independently within a single monorepo. Each micro-frontend serves a specific feature of the application and communicates with a central NestJS backend service.
- Microservices architecture.
- Independent development and deployment of frontends.
- Independent backend with NestJS Microservices.
- Efficient collaboration and code management using a monorepo.
micro-nest/
|-- apps/
| |-- app-1-ui/ # Micro-frontend 1 (e.g., User Dashboard)
| |-- app-2-ui/ # Micro-frontend 2 (e.g., Admin Panel)
| |-- shared/ # Shared components and utilities
| |-- app-1/ # NestJS micro service
|-- scripts/ # Utility scripts for project management
|-- .gitignore # Git ignore file
|-- .eslintrc # ESLint configuration file
|-- .eslintignore # ESLint ignore file
|-- .prettierrc # Prettier configuration file
|-- .prettierignore # Prettier ignore file
|-- docker-compose.yaml # Docker compose
|-- jest.config.ts # Jest config
|-- jest.preset.ts # Jest preset config
|-- package.json # Root package configuration
|-- README.md # This README file
|-- tsconfig.base.json # TypeScript configuration
|-- nx.json # Nx workspace configuration
- NodeJS >= 22
- npm i
Run npx nx serve [appName]
to start the development server. Happy coding!
Run npx nx build [appName]
to build the application. The build artifacts are stored in the output directory (e.g. dist/
or build/
), ready to be deployed.
To execute tasks with Nx use the following syntax:
npx nx <target> <project> <...options>
You can also run multiple targets:
npx nx run-many -t <target1> <target2>
..or add -p
to filter specific projects
npx nx run-many -t <target1> <target2> -p <proj1> <proj2>
Targets can be defined in the package.json
or projects.json
. Learn more in the docs.
nx run [appName]:docker-build
docker run [appName]:latest
docker compose up
nx g @nx/angular:remote appName --host=[hostApp] --port=[portValue]
nx g @nx/nest:app [appName]
- Nx
- NestJS
- Angular
- Jest
- Cypress
- Swagger
- Docker
We welcome contributions to MicroNest! Whether you're fixing a bug, improving documentation, or adding new features, your help is greatly appreciated. Please follow the guidelines below to contribute to this project:
- Fork the Repository
- Click on the "Fork" button at the top right corner of this repository page to create a copy of the repository in your GitHub account.
- Clone Your Fork
-
Clone your forked repository to your local development environment using the command:
git clone https://github.com/yourusername/micro-nest.git
-
Replace
yourusername
with your GitHub username.
- Create a New Branch
-
Before making any changes, create a new branch to work on. Use a descriptive branch name that indicates what you're working on:
git checkout -b feature/your-feature-name
- Make Your Changes
- Implement your changes in the codebase. Please ensure your code follows the project's style guide and best practices.
- Test Your Changes
-
Make sure your changes don't break existing functionality by running tests or building the project. Testing is crucial for maintaining code quality.
nx run [appName]:test
- Commit Your Changes
-
Add and commit your changes with a clear and concise commit message:
git add . git commit -m "[prefixes] [Summary] \n [Add description of your changes]"
- Push to Your Fork
-
Push your changes to your forked repository:
git push origin feature/your-feature-name
- Create a Pull Request
- Go to the original repository on GitHub, and you'll see a notification suggesting you create a pull request from your forked repo. Click on the "Compare & pull request" button.
- Provide a clear description of your changes, link any related issues (if applicable), and submit the pull request for review.
- Ensure that your code adheres to the existing style guides.
- Write clear and descriptive commit messages.
- When adding new features, include documentation and relevant tests.
- Check if your changes pass the CI/CD pipelines.
- If you encounter a bug or have a feature request, please use the issue tracker to report it.
- Provide as much detail as possible, including steps to reproduce the issue and any relevant screenshots.
- We expect contributors to adhere to the Code of Conduct. Please read it to understand what kind of behavior is expected.
Thank you for your contributions! Together, we can make MicroNest better.
MIT License
Copyright (c) 2024 NashTech Global
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.