Code Monkey home page Code Monkey logo

react-layr-realworld-example-app's Introduction

RealWorld Example App

React/Layr 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 React and Layr including CRUD operations, authentication, routing, pagination, and more.

How it works

General architecture

Both the frontend and the backend use Layr Layr, so there is no web API in between. The frontend communicate directly with the backend.

Hosting

  • The frontend is statically hosted in AWS S3 + CloudFront.
  • The backend is exposed via a single function hosted in AWS Lambda.
  • The database is hosted in a MongoDB Atlas cluster (free tier).

Install

Install the npm dependencies with:

npm install

Develop

Prerequisites

  • Make sure you have Docker installed as it is used to execute the MongoDB development database.
  • Generate a JWT secret by running the following command in your terminal:
    • openssl rand -hex 64

Running the app in development mode

Execute the following command:

FRONTEND_URL=http://localhost:13577 \
  BACKEND_URL=http://localhost:13578 \
  MONGODB_STORE_CONNECTION_STRING=mongodb://test:test@localhost:13579/test \
  JWT_SECRET="********" \
  npm run start

The app should then be available at http://localhost:13577.

Migrating the database

Navigate to the ./backend directory and execute the following command:

FRONTEND_URL=http://localhost:13577 \
  BACKEND_URL=http://localhost:13578 \
  MONGODB_STORE_CONNECTION_STRING=mongodb://test:test@localhost:13579/test \
  JWT_SECRET="********" \
  npm run migrate

Debug

Client

Add the following entry in the local storage of your browser:

| Key   | Value     |
| ----- | --------- |
| debug | layr:* |

Server

Add the following environment variables when starting the app:

DEBUG=layr:* DEBUG_DEPTH=10

To do

  • Implement a test suite

react-layr-realworld-example-app's People

Contributors

mvila avatar ericsimons avatar alonski avatar alundiak avatar esakkiraj avatar optikfluffel 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.