-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
This guide will walk you through setting up the UF r/place project on your local machine and deploying it to AWS.
Before you begin, make sure you have:
- Node.js 18 or higher - Download from nodejs.org
- npm (comes with Node.js)
- Git - Download from git-scm.com
- AWS Account - Create one at aws.amazon.com
- AWS CLI - Installation guide
# Check Node.js version (should be 18+)
node --version
# Check npm version
npm --version
# Check Git
git --version
# Check AWS CLI
aws --versiongit clone https://github.com/ufosc/UF_r-place.git
cd UF_r-place# Install all dependencies for both workspaces
npm installThis will install dependencies for:
- Root workspace (build scripts)
-
infra/workspace (CDK and infrastructure dependencies) -
web/workspace (Next.js and frontend dependencies)
You have several options for setting up AWS credentials. Choose the one that works best for you:
Option A: Using AWS CLI (Recommended)
aws configureOption B: Using Environment Variables
export AWS_ACCESS_KEY_ID=your-access-key-id
export AWS_SECRET_ACCESS_KEY=your-secret-access-key
export AWS_DEFAULT_REGION=us-east-1Option C: Using AWS Profiles
# Configure a named profile
aws configure --profile myprofile
# Use the profile
export AWS_PROFILE=myprofile# Replace with your 12-digit AWS account ID
export CDK_ACCOUNT=123456789012
# Choose your preferred region
export CDK_REGION=us-east-1To find your AWS account ID:
aws sts get-caller-identity --query Account --output textThis is a one-time setup per AWS account and region:
npm run cdk:bootstrapIf you see an error about unable to resolve AWS account, make sure you've completed step 4 above.
npm run cdk:deployThis will:
- Build the TypeScript infrastructure code
- Create AWS resources (Lambda function, API Gateway)
- Deploy your stack to AWS
- Output the API URL when complete
Important: Save the ApiUrl output from this command - you'll need it in the next step.
Create the environment file for the frontend:
# Replace <ApiUrl> with the URL from the previous step
echo "NEXT_PUBLIC_API_URL=<paste-api-url-here>" > web/.env.localExample:
echo "NEXT_PUBLIC_API_URL=https://abc123def4.execute-api.us-east-1.amazonaws.com/prod/" > web/.env.localnpm run devThis starts the Next.js development server at http://localhost:3000
- Open your browser to http://localhost:3000
- You should see "UF r/place" as the heading
- Below it should display "API says: Hello from UF r/place API!"
If you see an error message instead, check:
- The API URL in
web/.env.localis correct and ends with/ - The backend deployment completed successfully
- Your AWS credentials are still valid
-
Modify Lambda functions in
infra/lambda/ -
Update infrastructure in
infra/lib/ -
Deploy changes:
npm run cdk:deploy
-
Modify components in
web/app/ -
Changes are automatically hot-reloaded when running
npm run dev -
For production builds:
npm run build
From the root directory:
# Development
npm run dev # Start frontend dev server
npm run build # Build both frontend and backend
npm run lint # Run linting
# Deployment
npm run deploy # Deploy backend infrastructure
npm run cdk:deploy # Same as above
npm run cdk:bootstrap # Bootstrap CDK (one-time setup)From individual workspaces:
# Backend (from infra/ directory)
npm run build # Compile TypeScript
npm run synth # Generate CloudFormation templates
npm run deploy # Deploy to AWS
npm run destroy # Remove all AWS resources
# Frontend (from web/ directory)
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLintUF_r-place/
├── package.json # Root workspace & scripts
├── infra/ # AWS Infrastructure
│ ├── bin/app.ts # CDK app entry point
│ ├── lib/ # Infrastructure definitions
│ ├── lambda/ # Lambda function code
│ └── cdk.out/ # Generated CloudFormation (git-ignored)
└── web/ # Next.js Frontend
├── app/ # App Router pages & components
├── .env.local # Environment variables (git-ignored)
└── .next/ # Next.js build output (git-ignored)
This means CDK couldn't determine your AWS account/region. Make sure you've:
- Set up AWS credentials (step 3)
- Exported CDK_ACCOUNT and CDK_REGION (step 4)
- Run
aws sts get-caller-identityto verify your credentials work
- Ensure the URL in
web/.env.localends with/ - Check that the backend deployment completed successfully
- Verify the API Gateway was created in the AWS console
You need to create web/.env.local with the API URL from step 7.
Make sure you have the necessary permissions in your AWS account. You need permissions to create IAM roles, S3 buckets, and other resources.
Once you have the basic setup working:
- Explore the code - Check out the Project Overview for architecture details
- Add new features - See the Extensibility Guide
- Set up additional AWS resources - Follow the AWS Configuration Guide
- Deploy to production - Consider setting up CI/CD pipelines
- Check the AWS Configuration Guide for detailed AWS setup
- Review the Extensibility Guide for adding new features
- Look at the existing code in
infra/andweb/directories - Check AWS CloudWatch logs for Lambda function errors
- Use
npm run synthto see generated CloudFormation templates