Giter Club home page Giter Club logo

reflex-realworld-example's Introduction

RealWorld Example App

Reflex codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

This codebase was created to demonstrate a fully fledged fullstack application built with Reflex including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the Reflex community styleguides & best practices.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

How it works

Describe the general architecture of your app here

Getting started

You'll need two things to get up and running. A postgres database with the schema up in it and obelisk (the build tool for obelisk applications).

Obelisk

This step will require nix, so if you are just dipping your toes in the water and don't have nix already, you may want to consider downloading a NixOS virtualbox appliance from here.

Once you have an environment with nix up and running, please follow the obelisk installation instructions: https://github.com/obsidiansystems/obelisk/#installing-obelisk

Postgres Database

This code is shipped with a default config in ./config/backend/pgConnStr expects a postgres database running on localhost:5442 with a username and password of conduit/conduit.

Note:this is NOT best practice to ship secrets in your git repo. In this case our two secrets don't matter too much, but you should avoid copying this bit if you cargo-cult it.

Docker

If your already have docker, a super easy way to get a database up and running already populated with the schema and some test data is by running the following command:

docker run -p 5432:5432 benkolera/reflex-realworld-workshop-pg:latest

Please note that if you have postgres already running on this machine that this command will fail because docker can't open port 5432 on your machine. Change the command to -p 5433:5432 but don't forget to update config/backend/pgConnStr with the new port.

If you aren't familar with docker but you are with postgres, please follow the next step instead.

Postgres Setup

If you aren't already familar with docker but are comfortable with postgres, you probably just want to create the database directly! :)

Jump into your database as a superuser and run:

CREATE USER conduit WITH LOGIN PASSWORD 'conduit'; 
CREATE DATABASE conduit OWNER conduit;

This assumes that users connecting from localhost can password auth. You may have to change your postgres auth config to make this work or do something completely different and update ./config/backend/pgConnStr accordingly.

Quit from this session and test the credentials by running the database restore to your new db:

psql -h localhost -U conduit conduit -f db.sql

Running the app

Assuming that you have obelisk installed, a postgres database with the schema in it running and that the ./config/backend/pgConnStr settings point to your database, then you are good to go!

Run:

ob run

This will download a bunch of stuff but then hopefully display:

About to test the db connection. If ob run dies, check out config/backend/pgConnStr
Frontend running on http://localhost:8000/

If you hit http://localhost:8000 in chrome (not firefox or safari or edge: it's a limitation of the dev environment at the moment), you should see a fully styled page with sample articles in it.

reflex-realworld-example's People

Contributors

benkolera avatar dustinnorwood avatar bradparker avatar

Stargazers

 avatar

Watchers

James Cloos avatar

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.