This is the README file for the project "The Sustainable List". It provides instructions on how to set up and deploy the project on Vercel.
This project runs on the React framework Next.js and gets deployed on Vercel for maximum performance and infrastructure efficiency.
Before getting started, make sure you have the following:
- Vercel account
- Node.js installed
- Git installed
- Clone the repository:
git clone https://github.com/marcelkalveram/the-sustainable-list.git
- Navigate to the project directory:
cd the-sustainable-list
- Install dependencies:
npm install
Create an .env.local
file in the root directory of the project and add the necessary environment variables:
CONTENTFUL_ACCESS_TOKEN=""
CONTENTFUL_SPACE_ID=""
SENDGRID_API_KEY=""
NEXT_PUBLIC_RECAPTCHA_SITE_KEY=
RECAPTCHA_SECRET_KEY=
After logging in to Vercel (see Deployment below), these can be pulled directly from there using the following command:
vercel env pull .env.local
Run the following to pull in the latest content from the Contentful API:
npm run contentful:pull:local
IMPORTANT: this requires the two CONTENTFUL_...
keys above to be set to pull content from the Contentful space. Ask the project owner for access.
This script saves the data consumed by the app in the public folder at /public/data/index.json
so it can be access by the app at runtime.
The contentful:pull:local
script only works on localhost and sets the environment variables for Contentful for local dev environments before running the node script.
On Vercel, the build
command runs the non-local version of this script (contentful:pull
) since the environment variables are already available at build time.
- Start the development server:
npm run dev
- Open your browser and visit
http://localhost:3000
to see the project running locally.
To deploy the project on Vercel, follow these steps:
- Install the Vercel CLI:
npm install -g vercel
- Log in to your Vercel account:
vercel login
-
Configure the above environment variables for this project, following this guide: https://vercel.com/docs/projects/environment-variables
-
Deploy the project:
vercel
-
Follow the prompts to configure the deployment settings.
-
Once the deployment is complete, you will receive a unique URL for your project.
If you would like to contribute to this project, please follow the guidelines outlined in the CONTRIBUTING.md file.
This project is licensed under the MIT License.