Giter VIP home page Giter VIP logo

walk-the-world-backend's Introduction

Walk The World Backend

This is a backend for a trivial web application: the idea is for users to add their daily steps, which is aggregated towards the goal of walking around the world.

This served as a nice first project for working with Rust and serverless infrastructure.

Features

  • ๐Ÿฆ€ Rust ๐Ÿ™
  • ๐Ÿ”“ Cognito for login and identity management
  • ๐Ÿš€ API Gateway REST API (with request body validation to prevent failed lambda invocations)
  • ๐Ÿงจ DynamoDb
  • ๐Ÿ›  Staged deployments for everything!

๐Ÿ“ฆ Development

Install the serverless framework cli.

Run npm ci, which will make sure npm dependencies are installed based directly on your package-lock.json file. This only needs run once. The first time you run npx serverless deploy it will pull down and compile the base set of dependencies and your application. Unless the dependencies change afterwards, this should only happen once, resulting in an out of the box rapid deployment cycle.

๐Ÿ›ต Continuous integration and deployment

TODO using Github actions

Local deployment

serverless deploy -v

The -v is important as this will print out all the created resources from cloudformation. These resources are then environment variables for the frontend.

Creating a user

Either use a real signup flow or create a user using the aws cli

aws cognito-idp sign-up \
  --region YOUR_COGNITO_REGION \
  --client-id YOUR_COGNITO_APP_CLIENT_ID \
  --username [email protected] \
  --password Passw0rd!

And then verify the user

aws cognito-idp admin-confirm-sign-up \
  --region YOUR_COGNITO_REGION \
  --user-pool-id YOUR_COGNITO_USER_POOL_ID \
  --username [email protected]

๐Ÿ”ฌ Logs

With your function deployed you can now tail it's logs right from your project

$ npx serverless logs -f $FUNCTION_NAME

๐Ÿ‘ด Retiring

Good code should be easily replaceable. Good code is should also be easily disposable. Retiring applications should be as easy as creating and deploying them them. The dual of serverless deploy is serverless remove. Use this for retiring services and cleaning up resources.

$ npx serverless remove

โ„น๏ธ Additional information

This was bootstrapped from this Rust serverless template.

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.