ProSpects is a LinkedIn clone built for the SOEN 390 class at Concordia University. It is a full-stack web application built with Next.js, React, and TypeScript.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Before working on this project, ensure you have the following:
nvm (recommended) | Windows | Mac/Linux |
Node.js | Download |
-
Alongside VSCode, the following extensions will improve your development experience:
NOTE: These are all optional, but recommended
- Clone the project
git clone https://github.com/seinaas/SOEN-390.git
- Go to the project directory
cd SOEN-390
- Install dependencies
npm install
-
Create a
.env
(see 🚧 Environment Variables for more details) -
Start the server
npm run dev
You can add environment variables to the project by creating a .env
file in the project's root directory.
Environment variables in this project are type-safe, meaning you can't assign any value to any variable. As a consequence, these variables will show up as intellisense autocomplete options and, when they are used in code, TypeScript will know what type they are and can treat them appropriately.
To enforce this, we have to keep an environment schema up to date with any variable added to the .env
file. This schema can be found in /src/env/schema.mjs/
. Every variable that is present in the schema MUST be present in the .env
as well for the project to run.
An example .env
file can be found in the project.
The project currently support 3 test types:
- Unit Tests
- Integration Tests
- Component Tests
To run all tests, use
npm run test
Jest is used to write unit tests. These tests mainly cover the backend code (i.e., everything in src/server
). These tests can be found in the tests/server
directory.
When writing unit tests, you can call tRPC routes by importing the trpcRequest
utility function from tests/utils.ts
. This function accepts a session object so you can pass a mocked authenticated user, and it includes a mocked prisma instance in its context so you can simulate database requests.
To run unit tests, use
npm run test:jest
Component tests are handled by Cypress. These tests allow you to test components in an isolated environment. The main use case is for reusable components created in the src/components
directory. These tests can be found in the tests/cypress/component
folder.
To run component tests, use
npm run test:cypress:component
Alternatively, you can run component tests through the Cypress GUI with
npm run cypress
Like component tests, E2E tests are handled by Cypress. These tests are meant to simulate real-life use-cases of users interacting with the website. They can be found in the tests/cypress/e2e
folder.
To run E2E tests, use
npm run test:cypress:e2e
Alternatively, you can run E2E tests through the Cypress GUI with
npm run cypress
It is important to consistently run coverage reports to ensure your changes are properly tested. The coverage goal for this project is 80%. You can receive a full coverage report by running
npm run test
npm run coverage
You will see a summary of the report directly in your terminal, but you can obtain more information by opening coverage/index.html
.
When creating a pull request, please follow the following guidelines:
- Make sure your branch is up to date with the
main
branch. - Make sure your code is properly formatted and linted.
- Make sure your code is properly tested and that the coverage report is at least 80%.
- Name your pull request with the following format:
[fix/feat]: <issue ID> - <short description of the issue>
.
You can run the following scripts with npm run <script>
.
Script | Description |
---|---|
build |
Builds the project for production. |
dev |
Starts the development server. |
start |
Starts the production server. |
lint |
Runs ESLint on the project. |
prettier |
Runs Prettier on the project. |
cypress |
Runs Cypress in the GUI. |
cypress:headless |
Runs Cypress in headless mode. |
test:cypress:component |
Runs component tests. |
test:cypress:e2e |
Runs E2E tests. |
test:jest |
Runs unit tests. |
test |
Runs all tests. |
coverage |
Generates a coverage report. |
Vercel is used to deploy the project. The project is automatically deployed to production on every push to the main
branch. A preview deployment is created for every pull request. You can access the preview deployment by clicking on the "Details" link next to the Vercel check in the pull request.
- Seina Assadian | @seinaas
- William Tremblay | @WillTrem
- Samy Refik | @SamRfk
- Kevin Marnet Scanlan | @GuardiansAscend
- Lyuba Georgieva | @lyubageorgieva
- Maria Rivas | @MariaR001
- Mohammad Afandi | @AfandiM
- Mohsen Lhaf | @mohsen220
- Alexandra Zana | @Alexicazana