- Notifications
You must be signed in to change notification settings - Fork70
⚡ Ready-to-use, serverless, full-stack application built with AWS Lambda, Express.js, React, AWS DynamoDB and AWS HTTP API.
serverless-components/fullstack-app
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A complete, serverless, full-stack application built on AWS Lambda, AWS HTTP API, Express.js, React and DynamoDB.
Live Demo:https://www.serverless-fullstack-app.com
Install the latest version of the Serverless Framework:
npm i -g serverlessAfter installation, make sure you connect your AWS account by setting a provider in the org setting page on theServerless Dashboard.
Then, initialize thefullstack-app template:
serverless init fullstack-appcd fullstack-appThen, add the following environment variables in an.env file in the root directory, like this:
# This signs you JWT tokens used for auth. Enter a random string in here that's ~40 characters in length.tokenSecret=yourSecretKey# Only add this if you want a custom domain. Purchase it on AWS Route53 in your target AWS account first.domain=serverless-fullstack-app.comIn the root folder of the project, runserverless deploy
Lastly, you will need to add your API domain manually to your React application in./site/src/config.js, so that you interact with your serverless Express.js back-end. You can find the your API url by going into./api and runningserverless info and copying theurl: value. It should look something like thishttps://9jfalnal19.execute-api.us-east-1.amazonaws.com or it will look like the custom domain you have set.
Note: Upon the first deployment of your website, it will take a 2-3 minutes for the Cloudfront (CDN) URL to work. Until then, you can access it via thebucketUrl.
After initial deployment, we recommend deploying only the parts you are changing, not the entire thing together (why risk deploying your database with a code change?). To do this,cd into a part of the application and runserverless deploy.
When working on the./api we highly recommend usingserverless dev. This command watches your code, auto-deploys it, and streamsconsole.log() statements and errors directly to your CLI in real-time!
If you want to add custom domains to your landing pages and API, either hardcode them in yourserverless.yml or reference them as environment variables inserverless.yml, like this:
inputs:domain:${env:domain}
domain=serverless-fullstack-app.comSupport for stages is built in.
You can deploy everything or individual components to different stages via the--stage flag, like this:
serverless deploy --stage prod
Or, you can hardcode the stage inserverless.yml (not recommended):
app:fullstackcomponent:express@0.0.20name:fullstack-apistage:prod# Put the stage in here
Lastly, you can add separate environment variables for each stage using.env files with the stage name in them:
.env# Any stage.env.dev# "dev" stage only.env.prod# "prod" stage only
Then simply reference those environment variables using Serverless Variables in your YAML:
app:fullstackcomponent:express@0.0.20name:fullstack-apiinputs:domain:api.${env:domain}
And deploy!
serverless deploy --stage prod
Enjoy! This is a work in progress and we will continue to add funcitonality to this.
For more details on each part of this fullstack application, check out these resources:
- Serverless Components
- Serverless Express
- Serverless Website
- Serverless AWS DynamoDB
- Serverless AWS IAM Role
If you are running into CORS errors, see our guide on debugging themwithin the Express Component's repo
About
⚡ Ready-to-use, serverless, full-stack application built with AWS Lambda, Express.js, React, AWS DynamoDB and AWS HTTP API.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.
