Development
Getting Started
Add the following variables to your .env file:
NEXT_PUBLIC_CONTACT_NAME=xxx
NEXT_PUBLIC_CONTACT_ADDRESS=xxx
NEXT_PUBLIC_CONTACT_ADDRESS_CITY=xxx
NEXT_PUBLIC_CONTACT_ADDRESS_COUNTRY=xxx
NEXT_PUBLIC_CONTACT_EMAIL=xxx
NEXT_PUBLIC_CONTACT_WEBSITE=hostrefugees.eu
NEXT_PUBLIC_VERSION=0.0.1
NEXT_PUBLIC_GOOGLE_MAP_KEY=xxx
DATABASE_URL=postgresql://postgres:@127.0.0.1:5432/hostrefugees?sslmode=disable
EMAIL_ENABLE=true
EMAIL_NAME=xxx
EMAIL_EMAIL=xxx
SMTP_USERNAME=user
SMTP_PASSWORD=password
SMTP_HOST=smtp.your-email.com
AWS_S3_REGION=eu-central-1
AWS_S3_ACCESS_KEY=xxx
AWS_S3_ACCESS_SECRET=xxx
SECRET_COOKIE_PASSWORD=complex_password_at_least_32_characters_long
NODE_ENV=development
Then run the following two commands to start your local server:
npm install
npm run dev
Production Build
Make sure to set the NODE_ENV to production
to secure the iron session.
Iron Session
https://github.com/vvo/iron-session
Prisma
// To migrate the schema file and generate the client npx prisma migrate dev --skip-seed
// To generate the client npx prisma generate
Seeding Development Database
After applying all migration, run the following command to seed the database once:
npx prisma db seed
Securing Passwords
https://auth0.com/blog/hashing-in-action-understanding-bcrypt/
Google Maps
Sign up at Google to get an API Key for Maps.
Snapshot Tests
We use Jest Snapshot Testing for our components.
To add a new snapshot test, follow the instructions or use this example and then run npm run test
to automatically create the snapshot file.
To update an existing snapshot, adjust the test case and run npm run snapshot-update
.
Email Template
Every email uses a base responsive template that is located in material/email-template.html
. Before we send an email, we need to inline the css styles with a tool like htmlemail.io/inline.
Set environment variable EMAIL_ENABLE=true
to enable the emailing.
Docker Build
docker build -t hostrefugees .
docker run -p 3000:3000 hostrefugees
i18n
The app uses i18next for internationalization. We want to offer this website to as many people as possible therefore native translations are important. We welcome anyone to help us translate this app. To do so, follow these steps:
- If the language does not exist, create a folder in /translations and copy the files /translations/en/common.json and /translations/en/country.json in that folder
- Translate the existing values in those files and make sure you do not change the key
- Save and commit your changes
Note: If you do not add a translation in any given language, the app will default to English.
Contributors
Special thanks to Katerina Limpitsouni and undraw.co for providing the illustrations for this project.
Made with