All Projects → jimmylee → next-postgres

jimmylee / next-postgres

Licence: other
A minimal example web application using NextJS 12.0.7, Postgres 11, Google OAuth2 and other useful libraries.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to next-postgres

Fastapi React
🚀 Cookiecutter Template for FastAPI + React Projects. Using PostgreSQL, SQLAlchemy, and Docker
Stars: ✭ 501 (+595.83%)
Mutual labels:  postgres, oauth2
Go Oauth2 Server
A standalone, specification-compliant, OAuth2 server written in Golang.
Stars: ✭ 1,843 (+2459.72%)
Mutual labels:  postgres, oauth2
Next Postgres Sequelize
React 16.8.4 + NextJS 8.0.3 + Emotion + Sequelize 5/Postgres + Passport Local Auth + Google App Engine or Heroku Deployment
Stars: ✭ 176 (+144.44%)
Mutual labels:  postgres, emotion
google-workspace
A unofficial high level Python API wrapper for some of the productivity based Google APIs, that is focused on simplicity.
Stars: ✭ 74 (+2.78%)
Mutual labels:  oauth2
postgres-nest-react-typescript-boilerplate
No description or website provided.
Stars: ✭ 93 (+29.17%)
Mutual labels:  postgres
postgres
A PostgreSQL database used by Deis Workflow.
Stars: ✭ 37 (-48.61%)
Mutual labels:  postgres
restria
Entria's REST API boilerplate
Stars: ✭ 25 (-65.28%)
Mutual labels:  postgres
benefit
✨ Utility CSS-in-JS library that provides a set of low-level, configurable, ready-to-use styles
Stars: ✭ 51 (-29.17%)
Mutual labels:  emotion
www-react-postgres
A complete template for 2022 focused on around React, Postgres and various web3 integrations. You can use the template to make a website, a web application, a hybrid decentralized web application, or even a DAO.
Stars: ✭ 36 (-50%)
Mutual labels:  postgres
Data-Engineering-Projects
Personal Data Engineering Projects
Stars: ✭ 167 (+131.94%)
Mutual labels:  postgres
humhub-oauth
Social OAuths built for the Social Platform HumHub
Stars: ✭ 16 (-77.78%)
Mutual labels:  oauth2
Facebook-Login-Xamarin-Forms
Demo for login to Facebook API from Xamarin Forms
Stars: ✭ 41 (-43.06%)
Mutual labels:  oauth2
event-machine-skeleton
Dockerized skeleton for prooph software Event Machine
Stars: ✭ 34 (-52.78%)
Mutual labels:  postgres
python-hydra-sdk
Hydra SDK for Python
Stars: ✭ 16 (-77.78%)
Mutual labels:  oauth2
glific
The Main application that provides the core interface via the glific APIs
Stars: ✭ 110 (+52.78%)
Mutual labels:  postgres
oauthproxy
This is an oauth2 proxy server
Stars: ✭ 32 (-55.56%)
Mutual labels:  oauth2
typescript-graphql-postgres-boilerplate
Simple boilerplate integrated typescript, graphql, postgres and apollo server
Stars: ✭ 18 (-75%)
Mutual labels:  postgres
Database-Web-API
Dynamically generate RESTful APIs from the contents of a database table. Provides JSON, XML, and HTML. Supports most popular databases
Stars: ✭ 37 (-48.61%)
Mutual labels:  postgres
spring-boot-security-oauth2-google
Microservice using OAuth 2.0 and OpenID Connect to authenticate into Google and get information to a user.
Stars: ✭ 75 (+4.17%)
Mutual labels:  oauth2
gobarber-api-gostack11
API GoBarber / NodeJS / Express / Typescript / SOLID
Stars: ✭ 39 (-45.83%)
Mutual labels:  postgres

next-postgres

January 4th, 2022I recommend you use www-react-postgres instead because it does not have an express server or a need for babel, therefore the template has less dependencies. That means there will be less attention cost required.

This setup is using:

It is for:

Setup

Step 1

Clone this repository!

Step 2

Create an .env file at your project root.

CLIENT_ID=GET_ME_FROM_GOOGLE
CLIENT_SECRET=GET_ME_FROM_GOOGLE
JWT_SECRET=74b8b454-29a6-4282-bdec-7e2895c835eb
PASSWORD_SECRET=\$2b\$10\$oaBusYfHLawNiFDqsqkTM.
  • Generate your own PASSWORD_SECRET with BCrypt.genSaltSync(10). You need to escape $ signs.
  • Generate your own JWT_SECRET.
  • Obtain CLIENT_ID and CLIENT_SECRET from https://console.developers.google.com after you setup your application.
  • Use CMD+F to find REDIRECT_URIS in ~/common/credentials. Google needs this string for the Authorized redirect URIs setting. The default is: http://localhost:1337/sign-in-confirm.

Step 3

This is important. Enable People API. Otherwise Google Auth will not work.

Setup: Running the website (OSX)

All steps assume you have Homebrew installed on your machine. You might want to install iTerm since you need multiple terminal windows open as well.

Using another version of Postgres? That may be okay. I use Postgres 11 to share versions with Render but I have tried these steps with Postgres 9 as well.

Installing Postgres 11

Mileage may vary with a different version.

brew uninstall postgresql
brew install postgresql@11
brew link postgresql@11 --force

Installing Node

Make sure NodeJS version 10+ is installed on your machine.

brew install node

Installing nodemon

We use nodemon to reload the site whenever changes are made locally.

npm install -g nodemon

Installing Node packages

Once you have Postgres and Node, run these commands:

npm install
npm run dev

Run Postgres

In a seperate terminal tab run your postgres version, in this case the command below is referencing Postgres 11.

postgres -D /usr/local/var/postgresql@11 -p 1334

You may need to run brew services stop postgresql@11 since we're running postgres on a different port.

If you get an error that lock file "postmaster.pid already exists like I did, you can delete that file with something like rm /usr/local/var/postgresql@11/postmaster.pid.

Create a new database

  • Start with creating an admin user.
  • Finish with creating a database for testing.
# Enter Postgres console
psql postgres -p 1334

# Create a new user for yourself
CREATE ROLE admin WITH LOGIN PASSWORD 'oblivion';

# Allow yourself to create databases
ALTER ROLE admin CREATEDB;

# You need to do this to install uuid-ossp in a later step
ALTER USER admin WITH SUPERUSER;

# Exit Postgres console
\q

# Log in as your new user.
psql postgres -p 1334 -U admin

# Create a database named: nptdb.
# If you change this, update knexfile.js
CREATE DATABASE nptdb;

# Give your self privileges
GRANT ALL PRIVILEGES ON DATABASE nptdb TO admin;

# List all of your databases
\list

# Connect to your newly created DB as a test
\connect nptdb

# Exit Postgres console
\q

Setup: Fill database with tables

Run the following commands:

npm run do-setup-database
npm run do-seed-database

View the website

View http://localhost:1337 in your browser.

Scripts

If you need to run node script without running the server, use this example to get started

npm run script example

Setup: Production deploy

Coming soon.

Questions?

Feel free to slang any feels to @wwwjim.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].