Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/practicajs/practica
Node.js solution starter boilerplate that is production-ready, packed with ✅ best practices and built with simplicity in mind
https://github.com/practicajs/practica
best-practices boilerplate express fastify hacktoberfest mongodb nodejs postgresql starter-kit
Last synced: 5 days ago
JSON representation
Node.js solution starter boilerplate that is production-ready, packed with ✅ best practices and built with simplicity in mind
- Host: GitHub
- URL: https://github.com/practicajs/practica
- Owner: practicajs
- License: mit
- Created: 2022-01-31T09:31:09.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-10T06:36:47.000Z (12 days ago)
- Last Synced: 2024-12-10T11:03:37.934Z (12 days ago)
- Topics: best-practices, boilerplate, express, fastify, hacktoberfest, mongodb, nodejs, postgresql, starter-kit
- Language: TypeScript
- Homepage: https://practica.dev/
- Size: 47.4 MB
- Stars: 1,504
- Watchers: 26
- Forks: 136
- Open Issues: 100
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
![Best practices starter](/static/images/practica-logo.png)
### Generate a Node.js app that is packed with best practices AND simplicity in mind. Based off our repo [Node.js best practices](https://github.com/goldbergyoni/nodebestpractices) (96,100 stars)
![Twitter](/static/images/twitter-icon.png) [Twitter](https://twitter.com/nodepractices) | ![Site](/docs/static/img/site-icon.png) [Documentation site](https://practica.dev/)
# A One Paragraph Overview
Although Node.js has great frameworks 💚, they were never meant to be dev & production ready immediately (e.g., no architecture layers, DB schemas, docker file, etc etc). Practica.js aims to bridge the gap. Based on your preferred framework, we generate example code that demonstrates a full Microservice flow, from API to DB, that is packed with good practices. For example, we include a battle-tested error handler, sanitized API response, hardened dockerfile, thoughtful 3-tier folder structure, great testing templates with DB, and more. This saves a great deal of time and can prevent painful mistakes. All decisions made are [neatly and thoughtfully documented](https://practica.dev/decisions). We strive to keep things as simple and standard as possible and base our work on the popular guide: [Node.js Best Practices](https://github.com/goldbergyoni/nodebestpractices)
**1 min video 👇, ensure audio is activated**
https://user-images.githubusercontent.com/8571500/170464232-43355e43-98cf-4069-b9fc-6bc303a39efc.mp4
# `Table of Contents`
- [`Super-Quick Setup`](#super-quick-setup)
- [`Our Philosophies and Unique Values`](#our-philosophies-and-unique-values)
- [`Practices and Features`](#practices-and-features)
- [`The People Behind Practica.js`](#the-people-behind-practicajs)
- [`Our best practices guide, 78,000 stars ✨`](https://github.com/goldbergyoni/nodebestpractices)
- [`Contribution guide`](https://github.com/practicajs/practica/blob/main/CONTRIBUTING.md)
- [`Documentation site`](https://practica.dev/)
- [`YouTube`](https://www.youtube.com/channel/UCKrSJ0-jm7YVTM_hO7Me9eA)
- Coming Soon:
- Example Applications
- [Express, PostgreSQL, with common best practices](https://github.com/practicajs/practica/blob/main/docs/not-ready-yet.md)
- [Express, mongo-db, with common best practices](https://github.com/practicajs/practica/blob/main/docs/not-ready-yet.md)
- [Express, PostgreSQL, with all best practices (advanced)](https://github.com/practicajs/practica/blob/main/docs/not-ready-yet.md)
- [Minimal with project setup configuration only](https://github.com/practicajs/practica/blob/main/docs/not-ready-yet.md)
More Flavours
- Fastify, PostgreSQL
- Fastify, mongo-db
- Generate Your Own Interactively
- More coming soon
# Super-Quick Setup
### Run Practica.js from the Command Line
Run practica CLI and generate our default app (you can customize it using different flags):
```bash
npx @practica/create-node-app immediate --install-dependencies
```✨ And you're done! That's it, the code's all been generated. Our default setup includes Fastify for the web layer, Sequelize for the data access and PostgreSQL
Prefer express and Prisma? Just pass the right flags to the CLI:
```bash
npx @practica/create-node-app immediate --install-dependencies --web-framework=express --orm=prisma
```Prefer other DB? We use standard ORMs, read its docs and switch DB. This is your code, do whatever you like
### Start the Project
```bash
cd {your chosen folder name}
npm install
```Then choose whether to start the app:
```bash
npm run
```or run the tests:
```bash
npm test
```Pretty straightforward, right?
You just got a Node.js Monorepo solution with one example component/Microservice and multiple libraries. Based on this hardened solution you can build a robust application. The example component/Microservice is located under: *{your chosen folder name}/services/order-service*. This is where you'll find the API and a good spot to start your journey from
### Next Steps
- ✅ Start coding. The code we generate is minimal by design and based on known libraries. This should help you get up to speed quickly.
- ✅ Read our ['coding with practica'](https://practica.dev/the-basics/coding-with-practica/) guide
- ✅ Master it by reading our [docs at https://practica.dev](https://practica.dev).
# Our Philosophies and Unique Values
### 1. Best Practices _on top of_ known Node.js frameworks
We don't re-invent the wheel. Rather, we use your favorite framework and empower it with structure and real examples. With a single command you can get an Express/Fastify-based codebase with many thoughtful best practices inside
![Built on top of known frameworks](/static/images/on-top-of-frameworks.png)
### 2. Simplicity, how Node.js was intended
Keeping it simple, flat, and based on native Node/JS capabilities is part of this project's DNA. We believe that too many abstractions, high-complexity or fancy language features can quickly become a stumbling block for the team
To name a few examples, our code flow is flat with almost no level of indirection, no DI - it's just simple functions calling other functions. Although using TypeScript, almost no features are being used besides types, for modularization we simply use... Node.js modules
![Simplicity!](/static/images/abstractions-vs-simplicity.png)
### 3. Supports many technologies and frameworks
Good Practices and Simplicity is the name of the game with Practica. There is no need to narrow our code to a specific framework or database. We aim to support the popular Node.js frameworks and data access approaches
![Built on top of known frameworks](/static/images/tech-stack.png)
# Practices and Features
We apply dozens of practices and optimizations. You can opt in or out for most of these features using option flags on our CLI. The following table lists just a few examples out of the [full list of features we provide](https://practicajs.org/features).
| **Feature** | **Explanation** | **Flag** | **Docs** |
| ----------- | --------------- | -------- | -------- |
| Monorepo setup | Generates two components (e.g., Microservices) in a single repository with interactions between the two | --mr, --monorepo | [Docs here]() |
| Output escaping and sanitizing | Clean-out outgoing responses from potential HTML security risks like XSS | --oe, --output-escape | [Docs here]() |
| Integration (component) testing | Generates full-blown component/integration tests setup including DB | --t, --tests | [Docs here]() |
| Unique request ID (Correlation ID) | Generates module that creates a unique correlation/request ID for every incoming request. This is available for any other object during the request life-span. Internally it uses Node's built-in [AsyncLocalStorage](https://nodejs.org/api/async_hooks.html#class-asynclocalstorage) | --coi, --correlation-id | [Docs here]() |
| Dockerfile | Generates dockerfile that embodies >20 best practices | --df, --docker-file | [Docs here]() |
| Strong-schema configuration | A configuration module that dynamically load run-time configuration keys and includes a strong schema so it can fail fast | Built-in with basic app | [Docs here](https://github.com/bestpractices/practica/blob/main/docs/decisions/configuration-library.MD) |📗 **See our full list of features [here](https://practica.dev/features)**
# The People Behind Practica.js
## Steering Committee
Practica is a community-driven open-source project. It's being led voluntarily by engineers from many different companies. These companies are just a few who encourage their engineers to contribute and keep this project moving. 💚
![Autodesk](/static/images/autodesk.png)
A Nasdaq 100 company, a world leader in design software
![Cox2m](/static/images/cox2m.png)
Leader IoT provider, part of 'Cox Communication', the 3rd largest cable company in the US
## Core Team
Yoni Goldberg
Independent Node.js consultant
Michael Solomon
Node.js lead
Raz Luvaton
Node.js developer
Daniel Gluskin
Node.js lead
Ariel Steiner
Node.js developer
Tomer Kohane
Frontend geek
Dan Goldberg
Node.js lead
Ron Dahan
Node.js expert
# Partners
These companies are keen for continuous improvement and their engineers to have been known to contribute during work hours.
![Minta](/static/images/minta.png)
## Our Amazing Contributors 💚
A million thanks to these great people who have contributed code to our project:
Brian Clark
💻
Raz Luvaton
🖋 💻
Michael Solomon
💻
itainoam
💻 📆
shanizlo
💻
Ron Dahan
💻
AlonK
💻
Jose Luis Alvarez Herrera
🖋 💻
reinaldo-calderon-team
💻
KarelVerschraegen
📖
Daniel Morrison
🖋
Sean Lowe
💡 🖋
idobetesh
💻
Alejandra Acosta
💻
adandanielteamint
🖋
Rashad Majali
💻
yohai zvuloon
🖋
Yonatan Kra
🖋
Yoni Rapoport
🖋
perilevy
💻
ToMer-K
💻
hen arbel
💻
Mojca Ostir
💻
evbambly
🖋
Amir Adar
🖋
Sebastien Vaucouleur
🖋
Harry Dobrev
💻
Bassam Ismail
📖
Marcos Molina
💻
Isen Kasa
💻
Vishal Sharma
💻