Skip to content

floriankapaun/decarb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

decarb – decarbonized websites

Track and offset your websites carbon footprint effortless.

About

This project is split into a seperate API and Client. Only the Database is running inside a Docker Container for convenience and can easily be swaped out against any other PostgreSQL setup. I'm using yarn as my package manager but you should be good to run with npm as well.

Setup local dev environment

  1. Setup .env Vars

Create ./api/.env and ./client/.env and add Variables.

For a minimum Configuration see ./api/.env.example and ./client/.env.example.

  1. Start Docker Container for PostgreSQL and Adminer
$ cd db

# Install docker containers
$ docker-compose pull

# Start docker containers (in background)
$ docker-compose up -d

For further Database related information like creating Migrations or Fake-Data see ./api/src/prisma/README.md

  1. Start Client
$ cd client

# Install dependencies
$ yarn install

# Serve with hot reload at localhost:3000 (default)
$ yarn dev

For further Client related information like creating a production build see ./client/README.md

  1. Start API
$ cd api

# Install dependencies
$ yarn install

# Generate Prisma Client (only on first start)
$ yarn generate

# Apply Prisma Migrations to Database (only on first start)
$ yarn migrate_prod

# 7. Serve API in development mode with hot reload, 
# at localhost:4000 (default)
$ yarn dev

For further API related information like starting in production mode see ./api/README.md

  1. Stripe CLI

To test Stripe Webhooks in your local setup, you have to Install the Stripe CLI and login with your Stripe account.

# Listen to webhook triggers and forward them to the API
$ stripe listen --forward-to localhost:4000/api/v1/stripe/webhooks

Example Requests

You can find some pre-configured requests I exported from Insomnia in ./insomnia_requests.yaml. That file can be imported to Insomnia again but should be compatible with Postman as well, see doc.

Staging

Everytime you push a commit to branch origin/stage the new Version gets deployed to stage.decarb.website by the ./.github/workflows/staging-deployment.yml workflow.

For further information on how the Stage works and is setup, see ./stage-server-setup.md

Stripe

Default Credit Card Number for Testing: 4242 4242 4242 4242. The rest can be made up.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published