Git Product home page Git Product logo

graphql-clean-architecture's Introduction

GraphQL Clean Architecture with Hot Chocolate

Build and Push to Docker Hub

chilli cream log

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.

Database Schema

database schema

What's included:

Table of Content

Quick Start

After setting up your local DEV environment, you can clone this repository and run the solution.

Prerequisites

You'll need the following tools:

Development Environment Setup

First clone this repository locally.

  • Install all of the the prerequisite tools mentioned above.

Docker Configuration

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

Database Configuration

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.

Database Migrations

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

Build and run from source

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

License

Licensed under the MIT license.

PRs Welcomed

graphql-clean-architecture's People

Contributors

dependabot[bot] avatar gayankanishka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

graphql-clean-architecture's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.