This is the base project developed by nazar-si for Entropy Concept team to facilitate frontend development.
This repo comes with automated code generation CLI written in Python and several libraries preinstalled.
To start working on this project you need to run following commands:
npm i
npm run prepare
This project uses following libraries by default:
- Next.js - Metaframework for SSR
- React - UI Framework
- Zustand - State management
- Surreal UI - Our components library
- Tailwind - Styling classes
- SWR - Light-weight library for fetch queries
- Testing and Linting setups
- EsLint
- Jest
- React Testing Library
- Playwright
- CI/CD with Github Actions
- Zod - Schema validation library
- Docker
- Custom hooks
The following happens when commit is made:
- Typescript test
- You won't be able to make commit until all of the type errors are resolved
- If you expect error to happen use command
/* @ts-expect-error Error description*/
- Linting check
- Automatically finds problems in TS code
- Formatting
- So that code looks the same on every device
- Build step after
git push
to ensure that server can be successfully build before push
Every commit should start with a type:
<type>: commit message
For example
git commit -m 'fix: finally fixed this bug!'
Types of commits:
- build - build configuration change
next.config.js, tsconfig.json
etc. - chore - routine work
- ci - changes in CI/CD
- docs - documentation change
- feat - feature added
- fix - bug fix
- perf - performance improvement
- refactor - refactoring of the code
- revert - reversion of changes
- style - style and cosmetic updates
- test - test added, edited etc.
- trans - some directory changes
- security - security updates
- multi - multiple updates
- branch - branch manipulation
To add types or change commit process described above you may address nazar-si (@katze). Types can be also changed directly in commitlint.config.js.
To run CLI you can use following commands:
npm run cli
to enter command line interface or
npm run cli -- <command> -args
to execute commands directly. To get help you can type h
or help
. Basic functions are:
- Common libraries installation
- tabler-icons-react : Icons library
- react-dnd : Drag and Drop library
- react-cva : Class value authority to manage styles
- classnames : Manage classes conditionally
- react-motion : Animations library
- react-hook-form : Library to work with forms
- Generate code:
- Next.js pages
- Types
- React components
- API
- Zustand
- Tests
- More functionality will be added in the process of usage
npm run cli -- create page -<flag1> -<flag2> ...
or shorter
npm run cli -- c p -<flag><flag>...
Following flags are present:
-d - dynamic route
-a - catch-all route
-A - optional catch-all route
-g - group route
-i - put everything inside (index) folder
-e - generate error page
-l - generate layout file
-s - do not generate style file
-f - add default fetch functions
For example, to create Next.js dynamic route with Layout and Error page with prewritten fetching fountions one may use following command:
npm run cli -- c p path/page_name -dlef
The structure of the project is following:
┌ ○ /
├ ○ .husky : Commits settings
├ ○ app/api : API pages
├ ○ app : Application pages
├ ○ hooks : All the general hooks
├ ○ state : Zustand stores
├ ○ features : Features with own hooks, logic etc.
├ ○ e2e : E2E tests for Playwright
├ ○ tests : Tests
├ ○ ui : All UI components
└ ○ test-results : Results of test for Playwright