The repository contains a backend of a simple Conference Planner. The backend serves as a GraphQL server. You could either use InMemoryDatabase
or PostgreSQL
to persist the data. Application has docker container orchestration configured.
DISCLAIMER: Original non-layered solution could be found at ChilliCream/graphql-workshop. This repository focuses on applying the clean-architecture principles into the above solution. Also this repository contains some additional features.
What's included:
After setting up your local DEV environment, you can clone this repository and run the solution.
You'll need the following tools:
- .NET, version
>=6
- One of the below IDE of your choice
- Visual Studio, version
>=2022
- JetBrains Rider, version
>=2021.3
- Visual Studio Code
- Visual Studio, version
- Docker
First clone this repository locally.
- Install all of the the prerequisite tools mentioned above.
In order to get Docker working, you will need to add a temporary SSL cert and mount a volume to hold that cert. You can find Microsoft Docs that describe the steps required for Windows, macOS, and Linux.
The following will need to be executed from your terminal to create a cert.
For Windows:
dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\aspnetapp.pfx -p 1qaz2wsx@
dotnet dev-certs https --trust
FOR macOS:
dotnet dev-certs https -ep ${HOME}/.aspnet/https/aspnetapp.pfx -p 1qaz2wsx@
dotnet dev-certs https --trust
FOR Linux:
dotnet dev-certs https -ep ${HOME}/.aspnet/https/aspnetapp.pfx -p 1qaz2wsx@
In order to build and run the docker containers locally, execute below command from the root of the solution.
docker-compose -f 'docker-compose.yml' up --build
The default configuration of the application is to use an InMemory
database for persistence.
If you would like to use PostgreSQL
as the db layer, you will need to update src/GraphQL/appsettings.json
as follows:
{
"ConnectionStrings": {
"PostgresDbConnection": "YOUR_POSTGRES_CONNECTION_STRING"
},
"UseInMemoryDatabase": "false"
}
When you run the application the database will be automatically created (if necessary) and the latest migrations will be applied. The sample test data in NDC_London_2019.json
will be imported automatically.
To use dotnet-ef
for your migrations run below commands from the root of the project.
Run Migrations:
dotnet ef migrations add InitialMigration --project src/Infrastructure --startup-project src/GraphQL --output-dir Persistence/Migrations
Update database:
dotnet ef database update --project src/Infrastructure --startup-project src/GraphQL
With Visual studio: Open up the solutions using Visual studio.
- Restore solution
nuget
packages. - Rebuild solution once.
- Run the solution.
- Banana cake pop local URL here.
- Voyager local URL here
Licensed under the MIT license.