Skip to content

qiweiii/fullstack-cdk-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fullstack-cdk-app template

A fullstack app template:

  • Frontend:

    • React
    • TypeScript
    • Vite
    • AWS Amplify (for auth, api access, and continuous deployment)
  • Backend & infra:

    • TypeScript
    • Lambda for backend logics
    • AWS CDK (Amazon Cognito, S3, SSM, VPC, DDB, API Gateway, Amplify)

Install

npx degit qiweiii/fullstack-cdk-app my-app

Running locally

  1. make sure you have CDK_DEFAULT_ACCOUNT and CDK_DEFAULT_REGION in your env
  2. add a github access token in aws secrets manager with name and field:
    "github_access_token",
    {
      jsonField: "code-chanllenge-1-amplify",
    }
    
  3. install frontend dependencies: cd frontend => yarn
  4. build frontend: yarn build
  5. install infra dependencies: cd ../infra => npm install
  6. view infra stack: cdk synth
  7. deploy: cdk deploy (IMPT: record all the output info, you will need them later for local testing)
  8. in frontend/, create a .env file, add the following env variables based on the output from the previous step
    VITE_REGION=
    VITE_USER_POOL_ID=
    VITE_POOL_REGION=
    VITE_POOL_CLIENT_ID=
    VITE_IDENTITY_POOL_ID=
    VITE_FILEBUCKET=
    VITE_API_URL=
    
  9. run yarn dev to test the app locally (or directly use AppUrl from step 7 to view the deployed version)
  10. cdk destroy to clean up the stack

Todo

  • aws-sdk migrate to v3, so NodejsFunction can use node v18
  • frontend migrate to amplify v6

References & links