Demo:
- Docker installed
- Node.js 18+ installed
- Git installed
git clone https://github.com/crackedresearcher/devops-check.git
cd devops-checkcd fastapi-backend
# Create and activate virtual environment
python3 -m venv env
source env/bin/activate # On Windows: .\env\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Start the backend server
uvicorn main:app --reloadThe backend will run on http://localhost:8000
Open a new terminal and:
cd nextjs-frontend
# Install dependencies
npm install
# Create .env.local file
echo "NEXT_PUBLIC_SERVER_URL=http://localhost:8000" > .env.local
# Run the development server
npm run devThe frontend will run on http://localhost:3000
If you prefer using Docker:
# Create network
docker network create my-app-network
# Build and run backend
cd fastapi-backend
docker build -t my-fastapi-backend .
docker run -d --name backend --network my-app-network -p 8000:8000 my-fastapi-backend
# Build and run frontend
cd ../nextjs-frontend
docker build -t my-nextjs-frontend .
docker run -d --name frontend --network my-app-network -p 3000:3000 -e NEXT_PUBLIC_SERVER_URL=http://backend:8000 my-nextjs-frontend- Open http://localhost:3000 in your browser
- Test the API endpoints:
- If the frontend can't connect to the backend, check if NEXT_PUBLIC_SERVER_URL is set correctly
- For Docker issues, check logs using
docker logs frontendordocker logs backend - Make sure ports 3000 and 8000 are not in use by other applications
# For Docker setup
docker stop frontend backend
docker rm frontend backend
docker network rm my-app-network
# For local setup
# Just stop the running servers with Ctrl+C