Skip to content

Commit

Permalink
docs: updates readme.md file
Browse files Browse the repository at this point in the history
  • Loading branch information
ghoshnirmalya committed Jul 28, 2020
1 parent a91d1df commit ba71260
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 43 deletions.
3 changes: 0 additions & 3 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
HASURA_GRAPHQL_DATABASE_URL=postgres://postgres:@db:5432/postgres
HASURA_GRAPHQL_ENABLE_CONSOLE=false
HASURA_GRAPHQL_DEV_MODE=true
ENDPOINT=http://localhost:8080
HASURA_GRAPHQL_ADMIN_SECRET=secret
HASURA_GRAPHQL_MIGRATIONS_DIR=./migrations
HASURA_GRAPHQL_METADATA_DIR=./metadata
HASURA_GRAPHQL_JWT_SECRET={"type": "RS256", "key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwC3MrGY59v+HtzLQus1O\nKM+p5T8A2P1TJzm37fLJtDWJ8C3jDa/J+mVATY3Olks6oRbPJBNlBeO5/wLAhSGj\n3bRxNeO9LCMfTEYrsKa0B3vMm0lyBsefNvuCj9TMpHhWUvfDEe+r6qJXqT8DVdm4\nyamyfVt6orrrEr2aIbQZkbu7gcX2wKyyVGjtyPjp7yGy3zftfIEsinZd4C2CokbE\nq97wSn3lZXpGBrHJFFtLaRNuq4ukRvseU9iVF2u6uXbaZi706I75JHeKPvx45Q0D\nRV+tBEt3tWx/2srdQUpNdeAtFIUq1dD5swKr1yAm3bJBmP1EHUT+JBaia6lkfwli\naQIDAQAB\n-----END PUBLIC KEY-----\n"}
3 changes: 2 additions & 1 deletion frontend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ AUTH_PRIVATE_KEY=""
AUTH_PUBLIC_KEY=""
EMAIL_SERVER=""
EMAIL_FROM=noreply@example.com
NODE_TLS_REJECT_UNAUTHORIZED=0
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
76 changes: 37 additions & 39 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="https://user-images.githubusercontent.com/6391763/83290593-7a153300-a204-11ea-8285-e2af1b7bc9ed.png" alt="Logo"/>
<img src="https://user-images.githubusercontent.com/6391763/83290846-fa3b9880-a204-11ea-91d3-28afe7543d2c.png" alt="Logo"/>
</p>

<p align="center">
Expand All @@ -8,13 +8,10 @@
</a>
</p>

[![Deploy to
Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/hasura/graphql-engine-heroku)

This is a clone of Trello application built using Hasura and Next.js. This application has been bootstrapped using [Hasura Next.js Boilerplate](https://github.com/ghoshnirmalya/nextjs-hasura-boilerplate) This mono-repo consists of the following packages:
This is a boilerplate for building applications using Hasura and Next.js. This boilerplate consists of the following:

1. [**frontend**](https://github.com/ghoshnirmalya/nextjs-hasura-trello-clone/tree/master/packages/frontend): Next.js application
2. [**backend**](https://github.com/ghoshnirmalya/nextjs-hasura-trello-clone/tree/master/packages/backend): Dockerized Hasura application
1. [**frontend**](https://github.com/ghoshnirmalya/nextjs-hasura-boilerplate/tree/master/frontend): Next.js application
2. [**backend**](https://github.com/ghoshnirmalya/nextjs-hasura-boilerplate/tree/master/backend): Dockerized Hasura application

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
Expand Down Expand Up @@ -43,22 +40,26 @@ This is a clone of Trello application built using Hasura and Next.js. This appli

## Overview

This boilerplate is built using [Lerna](https://lerna.js.org/) for managing all the packages in a simple manner. Because of Lerna, it becomes very easy to install, develop and maintain a mono-repo structure.
This boilerplate is built using the following technologies:

<p align="center">
<img src="https://user-images.githubusercontent.com/6391763/83325828-f81d1c80-a28c-11ea-8601-8410a11a2937.png" alt="Screenshot"/>
</p>
1. [Chakra UI](https://chakra-ui.com/)
2. [Emotion](https://emotion.sh/)
3. [GraphQL](https://graphql.org/)
4. [urql](https://formidable.com/open-source/urql/)
5. [NextAuth](https://next-auth.js.org/)
6. [TypeScript](https://www.typescriptlang.org/)

It supports GraphQL Query, Mutation and Subscription out of the box.

## Requirements

1. [Node.js](https://nodejs.org/)
2. [npm](https://www.npmjs.com/)
3. [Lerna](https://lerna.js.org/)
4. [Docker](https://www.docker.com/)
3. [Docker](https://www.docker.com/)

## Packages

### 1. [**Frontend**](https://github.com/ghoshnirmalya/nextjs-hasura-trello-clone/tree/master/packages/frontend): Next.js application
### 1. [**Frontend**](https://github.com/ghoshnirmalya/nextjs-hasura-boilerplate/tree/master/frontend): Next.js application

This application is the primary user-facing application. Once it’s up and running (see Development section), it’s available on http://localhost:3000/.

Expand All @@ -68,7 +69,7 @@ To create a new user, we’ll have to Sign Up using Google. [NextAuth](https://n

![Home page after login](https://user-images.githubusercontent.com/6391763/87957968-93cd4b00-cace-11ea-8ce5-c3c9a14d63c8.png)

### 2. [**Backend**](https://github.com/ghoshnirmalya/nextjs-hasura-trello-clone/tree/master/packages/backend): Dockerized Hasura application
### 2. [**Backend**](https://github.com/ghoshnirmalya/nextjs-hasura-boilerplate/tree/master/backend): Dockerized Hasura application

[Hasura](https://hasura.io/) is an open source engine that connects to our databases & micro-services and auto-generates a production-ready GraphQL backend. It’s very easy to get Hasura up and running on our local system. All the migrations are set up in the [migrations](https://github.com/ghoshnirmalya/nextjs-hasura-trello-clone/tree/master/packages/backend/migrations) directory.

Expand All @@ -77,57 +78,51 @@ To create a new user, we’ll have to Sign Up using Google. [NextAuth](https://n
### 1. **Clone the application**

```sh
git clone https://github.com/ghoshnirmalya/nextjs-hasura-trello-clone
git clone https://github.com/ghoshnirmalya/nextjs-hasura-boilerplate
```

### 2. **Install Lerna globally**
### 2. **Install necessary dependencies for the frontend application**

```sh
npm install --global lerna
cd frontend && yarn install
```

### 3. **Bootstrap the packages**
### 3. **Create a .env file and copy the contents from .env.example (present in frontend directory)**

From the project root, we can run the following command to bootstrap the packages and install all their dependencies and linking any cross-dependencies:
### 4. **Generate the RSA keys**

```sh
lerna bootstrap
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout > public.pem
```

### 4. **Start the packages**

From the project root, we can run the following command to start our Node.js packages:
### 5. **Print the keys in the escaped format**

```sh
yarn start
awk -v ORS='\\n' '1' private.pem
```

The above command will start the frontend package on [http://localhost:3000/](http://localhost:3000).
### 6. **Copy the value of the key into the `AUTH_PRIVATE_KEY` key (in the .env file)**

The backend package doesn’t do anything after we execute the above command.
### 7. **Start the frontend application**

### 5. **Go inside the directory of the backend package**
From the frontend directory, we can run the following command to start our Next.js frontend application:

```sh
cd packages/backend
yarn start
```

### 6. **Create a .env file and copy the contents from .env.example (present in packages/backend directory)**

### 7. **Generate the RSA keys**
The above command will start the frontend application on [http://localhost:3000/](http://localhost:3000).

```sh
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout > public.pem
```
The backend package doesn’t do anything after we execute the above command.

### 8. **Print the keys in the escaped format**
### 8. **Go inside the directory of the backend package on another terminal window**

```sh
awk -v ORS='\\n' '1' public.pem
cd packages/backend
```

### 9. **Copy the value of the key into the `HASURA_GRAPHQL_JWT_SECRET` key (in the .env file)**
### 9. **Create a .env file and copy the contents from .env.example (present in backend directory)**

### 10. **Start docker-compose**

Expand All @@ -139,6 +134,9 @@ We need to start Docker and then run the above command which will change the cur

## Deployment

[![Deploy to
Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/ghoshnirmalya/nextjs-hasura-boilerplate/tree/master/backend)

We’re still working on this feature. The documentation will be updated soon.

## Other interesting repositories
Expand Down

3 comments on commit ba71260

@vercel
Copy link

@vercel vercel bot commented on ba71260 Jul 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on ba71260 Jul 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on ba71260 Jul 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.