Next.js + standalone Node.js/Express monorepo for my portfolio website.
My personal portfolio project used to showcase some of my skills, as reference for other projects and last but not least as my personal public portfolio website for potential employers, clients, etc.
Feel free to explore, use as a reference or for inspiration, make suggestions, etc.
This project is a monorepo containing both the frontend and backend parts of the portfolio website. The frontend is built with Next.js, while the backend is a standalone Node.js/Express server.
- Tech used: Next.js, Node.js/Express, Redux, TypeScript, PostgreSQL.
- Dev: clone, run
npm i && cd server && npm i
, then edit both ./.env and ./server/.env files, create db andnpm run dev
. - ...
- Test GHA CI/CD pipeline.
- ...
- Node.js >= v22.x and NPM
- MySQL database (>= v8.*).
- Redis (for caching).
- Setup the local dev environment.
- Clone the repo: https://github.com/KrisOzolins/portfolio.
- Run
npm i
to install Node.js dependencies. - Run
cd server && npm i
to install Node.js dependencies for the server. - Copy
.env.example
env file to.env.development
and fill in the necessary environment variables (both in project root and server directories). - When you first start the project (
npm run dev
) with an empty database, it will be automatically seeded with some initial data, otherwise you can runnpm run seed
from the server directory to seed the database.
The most important parameters in .env files are described below:
Project root:
- NEXT_PUBLIC_BASE_URL: Base URL of the project.
- NEXT_PUBLIC_NODE_PROTOCOL: Node.js server protocol.
- NEXT_PUBLIC_NODE_HOST: Node.js server host.
- NEXT_PUBLIC_NODE_PORT: Node.js server port.
- NEXT_PUBLIC_MAPS_API_KEY: Google maps Api key.
- NEXT_PUBLIC_RECAPTCHA_SITE_KEY: Your Recaptcha site key.
- NEXT_PUBLIC_ANALYTICS_ID: Google Analytics ID.
Server:
- PUBLIC_BASE_URL: Base URL of the project.
- SERVER_BASE_URL: Base URL of the server.
- NODE_PORT: Node.js server port.
- DB_*: Local DB credentials.
- MAIL_*: Your Mail credentials.
- JWT_SECRET: Your JWT secret key.
- SESSION_SECRET: Your session secret key.
- RECAPTCHA_SECRET: Your Recaptcha secret key.
- DROPBOX_ACCESS_TOKEN: Your Dropbox access token for DB backups.
- NEW_RELIC_APP_NAME: New Relic app name.
- NEW_RELIC_LICENSE_KEY: New Relic license key.
- GOOGLE_CLIENT_ID: Google client ID for OAuth.
- GOOGLE_CLIENT_SECRET: Google client secret for OAuth.
- In the project root directory, run
npm run dev
to start both the Next.js app and Node.js server. - Now you should be able to access and test the app at
http://localhost:3000
.
- VCS - Create a new
feat/*
orfix/*
branch from themain
. Once done, push it to the repo, create a pull request and merge it back to thestaging
branch. - Node.js - For using different versions of Node.js, you can use NVM.
- Tailwind, Prettier, ESLint, ...
- You can also use Docker for local development. To do so, you need to have Docker and Docker Compose installed on your machine.
- Run
docker-compose up
to start the project in development mode. - Now you should be able to access and test the app at
http://localhost:3000
.
- Project doesn't have any automated testing yet. So everything is first tested locally, then after push to
staging
branch, manual tests are done there.
The current process outlined below uses the GHA CI/CD system.
- Pushing/merging a PR into either
staging
ormain
initiates GHA CI/CD deployment pipeline. - Once everything is built (with no errors), DigitalOcean App platform's deployment is initiated.
- Custom NPM post-build hook is initiated to do any kind of needed housekeeping work after the container is built and about to be deployed live.
...
...
...
main
- the main branch.staging
- for staging environment.develop
- for local develop environment.task/*
andfeat/*
- created off ofmain
for new feature development.fix/*
- created off ofmain
for bug fixes.
...
- Project management is happening in both my personal Notion and Github Issues at the moment. Once everything is confirmed working correctly and migrated, we can move to only using github issues to keep the process simple.
- Meetings are held on a weekly basis, usually on Fridays.
- Project manager: Krisjanis Ozolins (kris@krisozolins.com).
- Technical lead: Krisjanis Ozolins (kris@krisozolins.com).
The MIT License (MIT) Copyright (c) 2024 KrisOzolins https://krisozolins.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.