Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adityanandanx/ecom
E-Commerce Nextjs + Express + Clerk
https://github.com/adityanandanx/ecom
clerk express jest nextjs nextjs14 prisma
Last synced: 23 days ago
JSON representation
E-Commerce Nextjs + Express + Clerk
- Host: GitHub
- URL: https://github.com/adityanandanx/ecom
- Owner: adityanandanx
- License: mit
- Created: 2024-03-24T10:23:17.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-03-26T09:20:55.000Z (10 months ago)
- Last Synced: 2024-04-29T09:22:25.446Z (8 months ago)
- Topics: clerk, express, jest, nextjs, nextjs14, prisma
- Language: TypeScript
- Homepage:
- Size: 120 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: docs/CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# E-Commerce Nextjs + Express + Clerk
An E-Commerce made with [Next.js](https://nextjs.org/) as the the BFF(Backend for Frontend), [Express](https://expressjs.com/) for the backend and [Clerk](https://clerk.com/) for authentication.
Other technologies are Prisma as the ORM, and Jest for writing unit tests for the express server.## Scripts -
The project is setup with [pnpm workspaces](https://pnpm.io/workspaces). Run these scripts in the root directory.
- To run the dev server for nextjs
```bash
pnpm dev:client
```
- To run the dev server for express server
```bash
pnpm dev:server
```
- To run tests for nextjs client
```bash
pnpm test:client
```
- To run tests for express server
```bash
pnpm test:server
```
- To run all tests
```bash
pnpm test
```## Server -
### Libraries -
- [Express](https://expressjs.com/) - http framework
- [Helmet](https://helmetjs.github.io/) - helps secure Express apps by setting HTTP response headers.
- [Prisma](https://www.prisma.io/) - ORM
- [Jest](https://jestjs.io/) - Testing
- [Clerk](https://clerk.com/) - Authentication### Architecture -
```
src/
api/
index.ts
api.test.ts
product/
product.controller.ts
product.model.ts
product.route.ts
product.service.ts
product.test.ts
/
.controller.ts
.model.ts
.route.ts
.service.ts
.test.ts
...
interfaces/
middlewares/
app.ts
app.test.ts
db.ts
index.ts
```- `src` is the root directory of the application.
- `api` contains entities.
- each `entity` contains a -
- service - Contains business logic and interacts with the data layer
- controller - handles request/response logic specific to the entity and calls appropriate services
- model - defines the structure and behavior of the entity
- route - binds controllers to appropriate routes and methods
- test - for testing every route and method
- `interfaces` contains base types and/or specific types for objects (not to be confused with models)
- `middlewares` middlewares for custom error handling, authentication and request validation
- `app.ts` main entry point of the application
- `db.ts` exports prisma client
- `index.ts` launches the app by listening on a specific port## Contributing
Read [Contributing Guidelines](./docs/CONTRIBUTING.md)
## Code of Conduct
Please adhere to the [Code of Conduct](./CODE_OF_CONDUCT.md).