A fullstack application for reading cat facts 🐱
This is an application written for a recruitment purpose. Description of the task:
Create a NODE.JS + EXPRESS backend service with 3 endpoints:
- /user/new -The purpose of this endpoint is to create and validate a new user and save it in the database of your choice
- /user/login - The purpose of this endpoint is to authenticate an already existing user
- /user/fetch_data - The purpose of this endpoint is to fetch data from a public API of your choice and return the data in the response. In order to do that the user must be authenticated. Not authenticated users shall not be granted access
Start with installing the dependencies
npm install
Before application run, infrastructure has to be turned on.
npm run start:infrastructure
To remove infrastructure and clean its resources
npm run stop:infrastructure
Following script will build shared library and start:
- Frontend on http://localhost:3001
- Backend on http://localhost:3000
npm start
Frontend communicates with the backend by a proxy to bypass CORS.
To shut down the application and clear resources, just stop the script and clean the infrastructure with:
npm run stop:infrastructure
In order to see Cat Facts on the page, go to either Signup or Signin page (buttons in the upper left corner).
Type your credentials and either sign in (if you have already an account) or Sign up with new credentials. This will move you back to the homepage, now filled with cat facts 🐱.
- Express.js
- sequelize
- passport-jwt
- MySQL on Docker
- React
- react-query
- react-router-dom
- styled-components
- (Additional) monorepository for sharing resources between the frontend and the backend
- Scaffold project
- add eslint and prettier
- create user resource
- implement jwt signup
- add
fetch_data
resource - use passport for jwt verification
- add business logic errors
- add dto validation
- add database connection
- add monorepo to share dtos between the frontend and the backend
- add dotenv for SECRET and etc.
- add controllers-class pattern
- add class-validator
- add redis for allowed tokens repository
- add webpack for building
- e2e
- Scaffold project and add needed libraries
- Create authentication context and service
- Create routing
- Create homepage
- Create signin page
- Create signout page
- Use react-query for backend calls
- Theme
- Error processing (single way of handling errors, currently console.log)
- Csfr for signin/up pages
- Persist token on a browser via either local storage, cookie, etc.
- Logout (currently by refresh)
- Create custom hooks to not call use query
- Customizable backend endpoint
- Refreshing JWT token
- e2e
Nest is MIT licensed.