A MERN stack monorepo application created to maintain my expenses.
Check it out here.
- Expenses
- Title, amount, category, date, group, and description attributes
- Sort by attribute
- Search by title
- Groups
- Group expenses together i.e. by card or bank account
- View group distributions for the month and year on the dashboard
This is a Node.js project. Get nvm if you are on a UNIX system or nvm-windows if on Windows, and then install node (and npm).
This project uses yarn workspaces to manage aspects of being a monorepo. Ensure you have yarn by running:
npm i -g yarn
This project uses a combination of eslint and prettier to enforce code style. To ensure that all commits conform to the standard, perform the following steps:
- Install the Prettier extension for VS Code
- In VS Code Settings, search for
Prettier: Config Pathand edit its value to be
.prettierrc
- In VS Code Settings, search for
Editor: Default Formatterand chooseesbenp.prettier-vscodefrom the dropdown
After cloning the repository, perform the following steps:
-
Place a
.envfile in backend/ with the following secrets:MONGODB_URI=[mongodb uri] JWT_ACCESS_SECRET=[secret for access tokens] JWT_REFRESH_SECRET=[secret for refresh tokens] -
Run
yarn install.
To start up both the backend and the frontend, run the following:
yarn start
To manually check changes on a mobile device, please perform the following:
-
Find your internal IP by running
ipconfig(Windows) orifconfig(UNIX) -
In
frontend/src/config.js, manually replacelocalhostwith your internal IP -
After running
yarn startwith the updated endpoints, on your mobile device, navigate tohttp://{internal_ip}:{frontend_port}
The reason this is necessary is because when your mobile device hits the frontend and attempts to perform any backend calls (logging in, fetching data), it would normally call localhost. Since your mobile device is not serving a backend locally, the calls fail. This modification to the endpoint ensures that the frontend hits the backend on your development machine, no matter where the frontend is being served.
HINT: Be sure not to commit these changes as the internal IP will not be the same between different machines.
- Open the terminal
- Install pm2 by running
npm install -g pm2 - Navigate to backend/
- Start the authentication server by running
sudo pm2 start authServer.js --name auth - Start the API server by running
sudo pm2 start app.js --name api - Navigate to frontend/
- Build a production version of the react-app by running
npm run build - Start the react-app by running
sudo pm2 serve build 5000 --spa --name client