Skip to content

AlanD20/aland20.com

Repository files navigation

AlanD20 Portfolio


Dynamic porfolio with support for admin dashboard to control the website.

To access the dashboard with the features, you must be authorized. Otherwise, you'll be redirected to the main page by taking advantage of Nextjs v12 middlewares.


Features

  • You can manage Projects, Skills, Tags, FAQs such as Add, Edit, Delete.
  • Validations and using Node mailer in Contact form.
  • The API routes that manages the website are protected. Which means, you have to be authorized to have access to the api routes.
  • Each content has Priority field which helps you give a content high ordering, to be rendered in the website.
  • Custom Directives are custom words that generate HTML tags for contents written with it. This process makes it easier to give styles and write the way you want to be rendered in the website. Custom Directives source code can be found in the modules folder. This feature is used in Project, FAQ descriptions.
  • You can find your Github ID through this website: Find Github ID

Deployment

  1. Install the packages

    yarn install
  2. You may generate a secret key for NEXTAUTH_SECRET environment variable using the following command. But, make sure you have installed openssl.

    yarn generate:secret
  3. The following files must be changed during deployment in production:

    • config.ts -> Host & Allowed Origins For API Access
    • .env -> Environment Variables
  4. Generate the database schema with default seeding

    yarn db:reset
  5. Finally, build the project and start pm2 config.

    yarn build && yarn pm2
  • For adding new changes, build the project and restart pm2 by passing our application name which we set in pm2.json file.

    yarn build && pm2 restart nextjs-portfolio

Development: Setup

  1. Install packages

    yarn install
  2. Define environment variables in .env file with your local environment. You can use .env.sample as a starting point

  3. Run the dev server

    yarn dev
  4. And everything should work :) Don't forget to checkout src/config directory to configure the app.

  • Note: Do not forget to restart the server when you make changes in .env file.

Useful Commands

  • postcss commands.

    yarn css:dev # Watch for changes during css files for development
    yarn css:prod # build minified css files for production
  • Any changes in Prisma schema, you must push it to the database and generate the prisma/client file. The following command does both job at once.

    yarn db:push
  • Prisma commands.

    yarn db:reset # Create + Seed with base data
    yarn db:push # Create only
    yarn db:seed # Seed only
    yarn prisma:studio # Start Prisma studio server
  • You may want to manually run prettier format.

    yarn format
  • You may want to generate a secret key for NEXTAUTH_URL. You need openssl installed on the machine.

    yarn generate:secret

Contribution

If you have anything to add or fix, feel free to open a new pull request.


License

This repository is under GNU General Public License v3