-
-
Notifications
You must be signed in to change notification settings - Fork 61
Developer Guide
We are editor and IDE agnostic in this project. You can use whatever editor or IDE you normally use. If you have not chosen a editor or IDE, we have Visual Studio and Visual Studio Code settings files included that will help you get going to work on this very easily.
Our stack is:
SQLite 3 Express 4 REACT 18.2 NodeJS latest LTS
The UI library is MUI v5
We use Jest, Cypress and REACT testing library for all unit, integration and e2e tests.
This app was bootstrapped with Create React App.
It is not hosted anywhere yet.
The development server runs at http://localhost:3000/
To start the app for development, cd to server and run npm start and wait for the server to start.
In another terminal, cd to client and run npm start and wait for the client to start.
TODO: add coding style conventions:
- Think on current coding style conventions we've been following and add document them here.
TODO: add naming conventions:
- Components that are intended to be used as reusable component should be named as
<[Custom]ComponentName>
so a reusable Alert component should be namedCustomAlert
. - We name component files the same as the components they represent with an
.jsx
extension soCustomAlert.jsx
. - We name CSS files the same as the component they belong to so the CSS file for the
Post.jsx
component would bePost.css
. - We name CSS classes using the BEM naming convention in the following manner:
-
Componenent__inner-element
: So that for thePost.css
the rule styling the close button would be written asPost__close-button
.
-
- Mention how database tables are named.
- We name our database tables with singular and uppercase names:
User
,Post
,Event
,Friendship
, etc. - We name our database table fields camelcased:
date
,title
,locationName
,imageUrl
, etc. - We name our routers
<[CRUD action of the router][modelName]Router>
when importing them on server/app.js. A router to add a new user post would be namedcreatePostRouter
. - The exception is with Read actions instead of calling a router say
readPostRouter
to get all user's posts, it would be namedgetPostRouter
so use get instead. - We create folders for different routes and give them model names:
/users
,/posts
,/events
, etc. - We names files
<[CRUD action of the router][modelName]>.js
sogetPost.js
orcreatePost.js
orupdatePost.js
ordeletePost.js
. - We name endpoints
/api/[modelName]/:id(if required)
so for Event models CRUD actions endpoints/api/event/:id(if required)
would be used.
-
We name test files
<[(functionality|component)to test][?-api].cy.js>
so a test for Login functionality test file would belogin.cy.js
and a test for Post functionality would bepost.cy.js
but a test for Post API endpoints would bepost-api.cy.js
. -
Test cases are named using the
"should do X when input Y"
naming convention. So"should login user when entering valid credentials"
for example.