Giter Club home page Giter Club logo

waipai's Introduction

WAI PAI

Wai pai is a lightweight publishing platform for everything from micro-blogging, todo lists, code snippets, recipes, journaling โ€” whatever you need it to be. No bloated CMS or social media dumpster fires. Just a place to jot down ideas, stash away notes, or express yourself in peace.

Each accounts' content is private by default, but can be shared publicly to their profile.

In Maori, "wai pai" translates to good water.

Requirements

  • Node.js with NPM or Yarn (for running a React app)
  • (optional) Docker & PostgreSQL for local development

Authentication

Authentication is handled with an Auth0 integration. To setup authentication:

  1. Create a new application at Auth0. Update the values in .env. Create an auth0 API to generate an "audience". This is required to have Auth0 return a full JWT and not just an access token.
  2. Under "Rules" in the Auth0 dashboard, create rules for each of the functions in server/auth.js. This will allow Hasura user info to be passed in the header and keep your users table in sync with Auth0.

NOTE: You may have issue connecting to you local docker server from Auth0. To get around this, I am using ngrok to expose a tunnel. To connect Auth0 to your localhost via a tunnel, start the ngrok server and copy/paste the generated URL into your Auth0 rule for inserting users. See below for more details on authentication.

Local Development

$ git clone [email protected]:evanheisler/waipai.git && cd waipai
$ yarn
$ cp .env.example .env

Hasura can run in whatever environment you are most comfortable. Pick a starting point from their quickstart.

To develop against a hosted server like Heroku all you need to do is use your heroku app address for the API variable in .env.

If you prefer to use a local instance of Hasura and an existing (or outside of Docker) PostgreSQL db, confirm that docker and psql are running, then:

$ cd server
$ cp docker-run.sh.example docker-run.sh // update database_url with your name, password and database instance.
$ ./docker-run.sh
$ hasura migrate apply --endpoint http://localhost:8080 --admin-secret <local secret from env> // provisions local database the first time

Start the client

$ yarn start

Start the Hasura console:

$ cd server && hasura console --admin-secret <secret used in script>

Authentication (optional)

If you've configured Auth0, aign up and logging in/out will work locally, but users will not be added to your local database โ€” they will only exist in Auth0. I recommend running ngrok to seed a couple user accounts so there is an ID attached to posts.

$ npm install ngrok -g
$ ngrok http 8080

You should now have a server at http://localhost:9695/api-explorer and a web client at http://localhost:3000.

Running Tests

Deployment

Frontend: Previews will be generated with pull requests via webhooks. Tagged releases will create production builds.

Backend: Run migrations with cd server && hasura migrate apply --endpoint http://your-prod-instance.herokuapp.com --admin-secret '<heroku admin secret>' (requires heroku cli login)

waipai's People

Contributors

evanheisler avatar dependabot[bot] avatar

Stargazers

Ryan Bridge avatar

waipai's Issues

Subscribe to new posts

UI should update with latest post on submit. Decide to either refetch or setup subscription.

CRUD Accounts

  • Select OAuth provider or SSO from Github
  • Setup React Router authenticated routes
  • User can sign up/in
  • User can sign out
  • User can view their sign in details

i18n

Replace strings with lang file.

Inline edit fields

If something can be updated, it should:

  • Denote editable with an icon
  • Toggle to a field state on click
  • Denote success or failure on change

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.