Giter Club home page Giter Club logo

sample's Introduction

Sample App - Simple Account creation / log in

For a sample application, I decided to throw together a somewhat simple Yarn/Webpack/Typescript/React/NodeJs/Docker/MongoDb app. The general functionality of the app is a web page that allows you to create an accout or log in. Once either of those actions have been taken, the user will be logged in for the next 12 hours or until they log out.

The build tools assume that you are using Yarn as your package manager. You can find information on how to set that up here.

Side Note: The log out functionality currently has a bug on the server. Some headers are being set on the Response after it is sent. I need to dig into what is setting those headers.

Code Structure

Source Code

src/
  client/
    components/
    utils/
    index.tsx
  server/
    routes/
    models/
    controllers/
    utils/
    index.ts

The source code is all in Typescript and for the client side React.js with JSX. This requires a build step. So Webpack has been set up to compile the client and server code into their respective bundles in the following structure:

dist/
  client/
    index.html
    main.css
    index.js
  server/
    index.js

Dev Environment

When the dev build is ran, it will automatically rebuild the client and server bundles when the files change. This allows for much faster development iterations and is just cool!

Start a dev build with this command:

yarn build:dev

Deployment Strategy

There are a few ways that this application could be deoployed.

The first method would be to use a managed container service. This would require finishing the container Dockerfile for the api that I started and then deploying the api container and the DB container to Amazon Elastic Container Service. Then define an Api Gateway in AWS that routes the appropriate requests to the Api container in ECS. In place of ECS, you could use Kubernetes to achieve the same goal as it pertains to container orchestration.

Another option would be to deploy directly to AWS without using containers. This would have the api deployed to an AWS Lambda Function, put all of the required assets (index.html, main.css, front end JS bundle) into an S3 Bucket, and then define an Api Gateway that would send requests to our previously created Lambda Function. Now what about MongoDb? You could either use AWS's DocumentDb or you could deploy the MongoDb to an EC2 instance and create a VPC connection between the Lambda function and the EC2 instance. To manage the creation of all the necessary resources that come with this option, I would most likely use a framework like Serverless or an infrastructure as code type of solution like Terraform.

sample's People

Contributors

archerface avatar

Watchers

 avatar  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.