Skip to content

A complete full-stack application demonstrating modern cloud-native deployment patterns using Spring Boot, React, and AWS services with enterprise-grade security.

License

Notifications You must be signed in to change notification settings

JohanCodeForFun/customer-management-aws-demo

Repository files navigation

Customer Management System - AWS Cloud Deployment

A complete full-stack application demonstrating modern cloud-native deployment patterns using Spring Boot, React, and AWS services with enterprise-grade security.

πŸ—οΈ Architecture

  • Frontend: React 18 + TypeScript + Vite (deployed on AWS Amplify)
  • Backend: Spring Boot 3.3.0 + Java 17 (deployed on AWS Elastic Beanstalk)
  • Database: PostgreSQL (Local development + AWS RDS)
  • CI/CD: GitHub Actions with automated testing and deployment
  • Security: SQL injection protection, input validation, CORS configuration

πŸ“ Project Structure

customer-management-aws-demo/
β”œβ”€β”€ client/                     # React TypeScript Frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/        # React components (CustomerList, CustomerForm)
β”‚   β”‚   β”œβ”€β”€ services/          # API service layer
β”‚   β”‚   β”œβ”€β”€ types/             # TypeScript interfaces
β”‚   β”‚   └── styles/            # CSS styling
β”‚   β”œβ”€β”€ .env.development       # Local environment variables
β”‚   β”œβ”€β”€ .env.production        # Production environment variables
β”‚   └── package.json           # Node.js dependencies
β”œβ”€β”€ server/                     # Spring Boot API
β”‚   β”œβ”€β”€ deploy/                # AWS deployment package
β”‚   β”‚   β”œβ”€β”€ .ebextensions/     # AWS Elastic Beanstalk configuration
β”‚   β”‚   β”œβ”€β”€ Procfile           # Process configuration for deployment
β”‚   β”‚   └── *.jar              # Compiled application
β”‚   β”œβ”€β”€ src/main/java/         # Java source code
β”‚   β”‚   └── com/example/relationaldataaccess/
β”‚   β”‚       β”œβ”€β”€ Customer.java                    # Data model
β”‚   β”‚       β”œβ”€β”€ RelationalDataAccessApplication.java  # Main application
β”‚   β”‚       └── controller/
β”‚   β”‚           └── CustomerController.java      # REST API endpoints
β”‚   β”œβ”€β”€ src/main/resources/    # Application configuration
β”‚   β”‚   β”œβ”€β”€ application.properties              # Local configuration
β”‚   β”‚   └── application-production.properties   # Production configuration
β”‚   β”œβ”€β”€ src/test/java/         # Security and unit tests
β”‚   β”œβ”€β”€ Dockerfile             # Container configuration
β”‚   β”œβ”€β”€ pom.xml               # Maven dependencies (build tool)
β”‚   └── mvnw                  # Maven wrapper
β”œβ”€β”€ .github/workflows/         # CI/CD pipelines
β”œβ”€β”€ amplify.yml               # AWS Amplify build configuration
β”œβ”€β”€ BUILD_AND_DEPLOY.md       # Detailed build and deployment guide
β”œβ”€β”€ DEPLOYMENT.md             # Comprehensive deployment guide
β”œβ”€β”€ SECURITY.md               # Security documentation
β”œβ”€β”€ INSTRUCTOR_GUIDE.md       # Educational materials
β”œβ”€β”€ setup.sh                  # Local development setup script
└── README.md                 # This file

✨ Features

Backend (Spring Boot)

  • βœ… REST API: Complete CRUD operations for customer management
  • βœ… Database Integration: PostgreSQL with JDBC Template
  • βœ… Security: SQL injection protection with parameterized queries
  • βœ… Input Validation: Comprehensive input sanitization and validation
  • βœ… CORS: Configured for local development and production
  • βœ… Health Checks: API monitoring endpoint
  • βœ… Environment Configuration: Development and production profiles

Frontend (React + TypeScript)

  • βœ… Modern UI: Responsive customer management interface
  • βœ… TypeScript: Type-safe development with interfaces
  • βœ… Component Architecture: Reusable React components
  • βœ… API Integration: Axios-based service layer
  • βœ… Real-time Updates: Live data synchronization
  • βœ… Error Handling: User-friendly error messages

DevOps & Deployment

  • βœ… Containerization: Docker support with security best practices
  • βœ… CI/CD Pipeline: GitHub Actions for automated deployment
  • βœ… AWS Ready: Configured for Amplify, Elastic Beanstalk, and RDS
  • βœ… Environment Management: Separate configs for dev/prod
  • βœ… Security Testing: Automated security validation
  • βœ… Educational Materials: Swedish guides and instructor resources

πŸš€ Quick Start

Prerequisites

  • Java 17+ (for backend development)
  • Node.js 18+ (for frontend development)
  • PostgreSQL 14+ (for local database)
  • Git (for version control)

Automated Setup

Run the setup script to configure everything automatically:

# Clone and setup
git clone https://github.com/JohanCodeForFun/customer-management-aws-demo.git
cd customer-management-aws-demo
chmod +x setup.sh
./setup.sh

Manual Setup

  1. Clone the repository:

    git clone https://github.com/JohanCodeForFun/customer-management-aws-demo.git
    cd customer-management-aws-demo
  2. Setup PostgreSQL database:

    # macOS with Homebrew
    brew install postgresql
    brew services start postgresql
    
    # Create database and user
    psql postgres -c "CREATE DATABASE customerdb;"
    psql postgres -c "CREATE USER customeruser WITH PASSWORD 'customerpass';"
    psql postgres -c "GRANT ALL PRIVILEGES ON DATABASE customerdb TO customeruser;"
  3. Start the backend:

    cd server
    ./mvnw spring-boot:run
  4. Start the frontend (in a new terminal):

    cd client
    npm install
    npm run dev

Access the Application

πŸ”§ API Endpoints

Customer Management

  • GET /api/customers - List all customers
  • GET /api/customers/{id} - Get customer by ID
  • POST /api/customers - Create new customer
  • DELETE /api/customers/{id} - Delete customer
  • GET /api/customers/search?name={name} - Search customers by name

System

  • GET /api/health - API health check

Example API Usage

# Get all customers
curl http://localhost:8080/api/customers

# Create a new customer
curl -X POST http://localhost:8080/api/customers \
  -H "Content-Type: application/json" \
  -d '{"firstName": "John", "lastName": "Doe"}'

# Search customers
curl "http://localhost:8080/api/customers/search?name=John"

# Delete customer
curl -X DELETE http://localhost:8080/api/customers/1

πŸ›‘οΈ Security Features

  • SQL Injection Protection: Parameterized queries with input validation
  • Input Sanitization: Character filtering and length limits
  • CORS Configuration: Secure cross-origin resource sharing
  • Environment-based Security: Production-ready configurations
  • Docker Security: Non-root user containers

For detailed security information, see SECURITY.md.

☁️ AWS Cloud Deployment

This application is configured for deployment to AWS using:

  • AWS Amplify: Frontend hosting with CDN
  • AWS Elastic Beanstalk: Backend auto-scaling and load balancing
  • AWS RDS: Managed PostgreSQL database
  • GitHub Actions: Automated CI/CD pipeline

For step-by-step deployment instructions, see DEPLOYMENT.md.

Quick Deploy to AWS

  1. Set up AWS infrastructure (RDS, Elastic Beanstalk, Amplify)
  2. Configure GitHub repository secrets
  3. Push to main branch to trigger deployment
git push origin main  # Triggers automatic deployment

πŸ› οΈ Technology Stack

Backend

  • Spring Boot 3.3.0 - Application framework
  • Spring Web - REST API development
  • Spring JDBC - Database access layer
  • PostgreSQL - Primary database
  • JUnit 5 - Testing framework
  • Maven - Build and dependency management (single build tool)

Frontend

  • React 18 - UI library
  • TypeScript - Type-safe JavaScript
  • Vite - Build tool and development server
  • Axios - HTTP client for API calls
  • CSS3 - Styling and responsive design

DevOps & Infrastructure

  • Docker - Containerization
  • AWS Amplify - Frontend hosting and CI/CD
  • AWS Elastic Beanstalk - Backend deployment and scaling
  • AWS RDS - Managed PostgreSQL database
  • GitHub Actions - Continuous integration and deployment

πŸ§ͺ Development & Testing

Running Tests

# Backend tests (includes security tests)
cd server
./mvnw test

# Frontend tests
cd client
npm test

Development Workflow

  1. Feature Development: Create feature branch from main
  2. Local Testing: Test both frontend and backend locally
  3. Pull Request: Submit PR for code review
  4. Automated Testing: GitHub Actions runs tests
  5. Deployment: Merge to main triggers deployment

Debugging

# View backend logs
cd server
./mvnw spring-boot:run --debug

# View frontend development server
cd client
npm run dev -- --debug

🀝 Contributing

This project demonstrates modern full-stack development with AWS cloud deployment. Contributions are welcome!

How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow existing code style and patterns
  • Add tests for new features
  • Update documentation as needed
  • Ensure all tests pass before submitting PR

Issues and Feedback

  • πŸ› Bug Reports: Use GitHub Issues with bug template
  • πŸ’‘ Feature Requests: Describe use case and expected behavior
  • ❓ Questions: Use Discussions for general questions
  • πŸ”’ Security Issues: Report privately via email

πŸ“š Additional Resources

πŸ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE.txt file for details.

πŸ™ Acknowledgments

  • Spring Guides: Based on Accessing Relational Data tutorial
  • Spring Boot Team: For the excellent framework and documentation
  • React Team: For the powerful UI library
  • AWS: For comprehensive cloud platform and documentation
  • Open Source Community: For the tools and libraries that make this possible

Built with ❀️ by Johan | GitHub | LinkedIn

About

A complete full-stack application demonstrating modern cloud-native deployment patterns using Spring Boot, React, and AWS services with enterprise-grade security.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 18