This example is a dockerized project with the following services: Postgres or YugabyteDB, GraphQL Engine, Minio, and Next.js. The project has one external service dependency for payment handling, which we've chosen to implement with Stripe. User authentication and authorization, cart management, order management and product information management is stored in Postgres or YugabyteDB and architected through Hasura GraphQL Engine. Minio is utilized for asset storage as it implements a common S3 interface.
See the Architecture Documentation.
Service | Functionality | Licensing |
---|---|---|
Postgres or YugabyteDB | PIM, Cart Management, User Management, User Authentication, Order Management | OSS |
Hasura | Business Logic Routing, Unified API, Access Control Management | OSS |
NextJS | Serverless business logic handlers, web application framework | OSS |
Minio | S3-compatible object storage (file and image upload) | OSS |
Stripe | Payment handling | Freemium |
Follow the steps below to run the apllication locally with Docker using PostgreSQL and YugabyteDB as a database:
-
(Optional) Modify the
.env.local.example
with your real Stripe test keys if you want checkout to work and then execute this command:cp .env.local.example .env
-
Start the application using YugabyteDB or PostgreSQL as a database:
If you already have a Postgres or YugabyteDB instance running locally, then:
- Double check the following two variables in the
docker-compose-local.yaml
file:HASURA_GRAPHQL_DATABASE_URL PG_DATABASE_URL
- Start the app:
docker-compose -f docker-compose-local.yaml up
Alternatively, you can start the app with a database instance running alongside in the container:
- For on-prem PostgreSQL deployment:
docker-compose -f docker-compose-postgres.yaml up
- For on-prem YugabyteDB deployment:
docker-compose -f docker-compose-yugabyte.yaml up
-
Navigate to the
hasura
directory:cd hasura
-
Create the
config.yaml
file from the template for local deployments:cp local.config.yaml config.yaml
-
Create the
databases.yaml
file from the template for local deployments:cp metadata/databases/local.databases.yaml metadata/databases/databases.yaml
-
Apply metadata and load sample data:
hasura metadata apply hasura migrate apply hasura metadata reload hasura seeds apply
-
Visit the following endpoints:
Visit http://localhost:3000 for Next.js frontend
Login at /account/login has default credentials "[email protected]:password"
Login at /admin/account/login has default credentials "[email protected]:password"
Visit http://localhost:8060 for Hasura console (admin secret = "my-secret")
Visit http://localhost:9000 for Minio dashboard (login = "minio:minio123")
Visit http://localhost:7001 for Yugabyte Master UI
Visit http://localhost:9001 for Yugabyte TServer UI