This is a personal practice creating an eCommerce app using the followings technologies:
- Node.js (Express.js)
Note
You can download the lates version here Node
- React.js
- Typescript
- MongoDB (Mongoose)
Note
You can download the lates version here MDB Compass
- JWT
This app will help to get the knowledge about how the technologies works together using APIs.
Still in development...
Clone the repository git clone
then split the terminal or open another
the repository have two folder server that is the backend and client that is the
frontend, cd client
and install the dependencies npm install
and cd server
in the other terminal and do the same.
To run the server in development mode use npm run dev
then use npm run build
to build the production mode, finaly use npm run start
to start the server
ready to use.
Important
You need to create a .env file for the database and others enviroments variable in both server and client, an example for the server: DATABASE_URI=mongodb://localhost:27017/rest-practice PORT=3001 PRIVATE_KEY=secret
The server backup You can backup your database data using the comand:
npm run backup:ts
this run the collection.ts script that save the documents in
each collections for the complete database.
Run npm run backup
in dev mode to make a backup for the database, or
npm run backup:json
in production mode, otherwise you can restore the database
using npm run restore
Important
You need to have installed the MongoDB Database Tools if you not have it you can download from here Tools
To run the client can use npm start
in dev mode or npm run build
to
transpile the code from Typescript to Javascript and start the project.
The entire application uses Typescript and JSON and the controllers endpoints are validated.
The backend have the followings endpoints and user authentication using JWT and middleware validator
Note
All endpoints are are funcional but no all are in use 'cause the applications isn't complete yet.
User endponints
- post - /sign-up
- post - /log-in
- post - /log-out
- get - /users
- put - /update-user/:id
- delete - /delete-user/:id
Products endpoint
- post - /create-products
- get - /get-products
- get - /get-products/:id
- get - /get-products/by-category:id
- put - /update-products/:id
- delete - /delete-products/:id
Category endpoints
- post - /create-category
- get - /get-categories
- get - /get-categories/:id
- put - /update-category/:id
- delete - /delete-category/:id
The Client app was made using Typescript applying best practices like:
- Type safety
- Null safety
- Enviroment variables
- React hook useEffect
- Error validator
And all the components was created from scratch using:
- CSS modules
- CSS nesting
- CSS variables
- Web toolkit
- Media querys
The client app is intended to be responsive...