This is a service for a community of devs to network, built by 100Devs for 100Devs. Discussion can be found on the Discord Thread.
Message Tim on Discord if you want to be added as a collaborator.
Branch names should be #issuenumber-shortname
e.g. #2-discord-auth
or #4-profile-schema
. If the branch is not associated with an issue, use your initials instead e.g. tc-fix-profiles
.
- Git
- Node.js v18.14.0 or nvm
- Docker (preferred) or a Postgres server
- Fork the project's repository on GitHub and clone it to your local system using Git.
git clone [email protected]:timmyichen/dev-directory.git
- Navigate to the project directory in your terminal.
cd dev-directory
- If using Docker, ensure Docker is running and run dependencies
npm run docker:deps
If you're NOT using Docker, be sure to start your Postgres server.
- Ensure you are on Node v18.14.0. If you are using NVM, you can run the following to automatically use the correct version.
nvm use
- In a new terminal, run the command
npm ci
to install all the necessary packages for the project. - Copy
.env.sample
to.env
and configure it for your local environment. - If it's your first time setting it up, run migrations:
npm run sequelize-cli db:migrate
If you get the error: 'password authentication failed for user "postgres"' while using docker, check to see if postgres is already installed on your computer. If it is, it may interfere with our default docker configuration. If you are familiar with port mapping, you can change the port postgres is using. Otherwise, uninstalling postgres will solve the error.
- Run
npm run dev
to start the development server.
That's it! You're now ready to start working on the project.
If using Docker, you can run
docker:db
to log into the Postgres CLI.
When making changes to a model's properties or the database schema, you'll need to create a migration. You can do so via the Sequelize CLI (replace name-of-migration
):
npm run sequelize-cli migration:generate --name name-of-migration
Edit the migration - see more detailed docs here
To run migrations:
npm run migrate
To rollback the last-run migration:
npm run migrate:undo
We use jest for unit testing on the client and server, and for acceptance tests on the server in conjunction with supertest.
Run all tests with:
npm run test
You can also run a single test:
npm run test -- auth.test.ts
You can run in watch mode, which is useful for when you're developing/writing the tests:
npm run test:watch -- auth.test.ts
We use Cypress for UI testing.
To run tests manually:
- Execute
npm run cypress:open
- Select E2E testing
- Choose a browser
- Select the test spec you wish to run
You may also run Cypress tests from the CLI with: npm run cypress
We have a CI/CD pipeline that will automatically deploy to a staging app on Heroku. The flow is:
- A PR is merged to
main
- Lint, Type Checking, and Tests are run
- If passed, heroku automatically builds the app:
- By running
next build
, and - Compiling the server into JS
- By running
- Migrations are then run against the staging database
- This is then deployed onto a Basic Heroku dyno at the link below
If at any point any of these steps fail, it will not continue.
The staging app behaves exactly like the production app, but should not be used as the production app since data may be deleted from it at any point.
The production app will eventually require a manual deploy but staging can be used as a way to test features in a production environment using "production" data.
_--_ _--_
/#()# #\ /# #()#\
|()## \#\_ \ / _/#/ ##()|
|#()##-=###\_ \ / _/###=-##()#|
\#()#-=## #\_ \ / _/# ##=-#()#/
|#()#--==### \_ \ / _/ ###==--#()#|
|#()##--=# #\_ \!!!/ _/# #=--##()#|
\#()##---===####\ X|X /####===---##()#/
|#()#____==#####\ / Y \ /#####==____#()#|
\###______######|\/#\/|######______###/
()#O#/ ##\_#_/## \#O#()
()#O#(__-===###/ _ \###===-__)#O#()
()#O#( # ###_(_|_)_### # )#O#()
()#O(---#__###/ (_|_) \###__#---)O#()
()#O#( / / ##/ (_|_) \## \ \ )#O#()
()##O#\_/ #/ (_|_) \# \_/#O##()
\)##OO#\ -) (_|_) (- /#OO##(/
)//##OOO*| / | \ |*OOO##\\(
|/_####_/ ( /X\ ) \_####_\|
/X/ \__/ \___/ \__/ \X\
(#/ \#)