Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ FRONTEND_HOST=http://localhost:5173
# Environment: local, staging, production
ENVIRONMENT=local

PROJECT_NAME="Full Stack FastAPI Project"
STACK_NAME=full-stack-fastapi-project
PROJECT_NAME="Lesmee"
STACK_NAME=lesmee

# Backend
BACKEND_CORS_ORIGINS="http://localhost,http://localhost:5173,https://localhost,https://localhost:5173,http://localhost.tiangolo.com"
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@ node_modules/
/playwright-report/
/blob-report/
/playwright/.cache/


.opencode/*
plans/*
.claude/*
.venv/
/backend/plans
/docs
197 changes: 197 additions & 0 deletions DEVELOPMENT-DEV.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
# LesMee Development Environment

This guide covers how to set up and use the LesMee development environment using Docker Compose.

## Quick Start

### Prerequisites
- Docker Desktop installed and running
- Git

### Setup
```bash
# Clone the repository (if not already done)
git clone <repository-url>
cd lesmee-full

# Start the development environment
docker-compose -f docker-compose.dev.yml --env-file .env.dev up --build -d
```

### Access Services
Once started, you can access:
- **Frontend**: http://localhost:5173 (React/Vite with hot reload)
- **Backend API**: http://localhost:8000 (FastAPI with auto-reload)
- **API Documentation**: http://localhost:8000/docs (Swagger UI)
- **Health Check**: http://localhost:8000/api/v1/utils/health-check/ (Database + Redis status)

## Services Overview

### Database (PostgreSQL)
- **Port**: 5432
- **Host**: localhost
- **Database**: lesmee_dev
- **Username**: postgres
- **Password**: postgres123

Connect with your favorite PostgreSQL client (DBeaver, pgAdmin, TablePlus, etc.)

### Redis
- **Port**: 6379
- **Host**: localhost
- **Password**: redis123

Use Redis CLI or Redis GUI tools like RedisInsight.

### Backend (FastAPI)
- **Port**: 8000
- **Auto-reload**: Enabled
- **API Docs**: http://localhost:8000/docs
- **Health Check**: http://localhost:8000/api/v1/utils/health-check/

### Frontend (React/Vite)
- **Port**: 5173
- **Hot Reload**: Enabled
- **Dev Server**: Vite development server

## Development Workflow

### Making Changes
1. **Backend**: Edit files in `./backend/` - changes trigger automatic reload
2. **Frontend**: Edit files in `./frontend/` - changes trigger hot reload via Vite

### Environment Variables
Edit `.env.dev` to customize development settings:
- Database credentials
- Redis configuration
- Admin user credentials
- CORS origins

### Database Management
```bash
# Access database container
docker-compose -f docker-compose.dev.yml exec db psql -U postgres -d lesmee_dev

# Run migrations manually
docker-compose -f docker-compose.dev.yml exec backend alembic upgrade head

# Create new migration
docker-compose -f docker-compose.dev.yml exec backend alembic revision --autogenerate -m "description"
```

### Redis Management
```bash
# Access Redis CLI
docker-compose -f docker-compose.dev.yml exec redis redis-cli

# Authenticate with password
AUTH redis123
```

## Useful Commands

### Environment Management
```bash
# Start development environment
./scripts/dev-start.sh

# Stop development environment
./scripts/dev-stop.sh

# View logs for all services
docker-compose -f docker-compose.dev.yml logs -f

# View logs for specific service
docker-compose -f docker-compose.dev.yml logs -f backend
docker-compose -f docker-compose.dev.yml logs -f frontend
docker-compose -f docker-compose.dev.yml logs -f db
docker-compose -f docker-compose.dev.yml logs -f redis
```

### Container Management
```bash
# Rebuild specific service
docker-compose -f docker-compose.dev.yml up --build -d backend

# Restart specific service
docker-compose -f docker-compose.dev.yml restart backend

# Execute commands in containers
docker-compose -f docker-compose.dev.yml exec backend bash
docker-compose -f docker-compose.dev.yml exec frontend sh
```

### Cleaning Up
```bash
# Stop and remove containers, networks, volumes
docker-compose -f docker-compose.dev.yml down -v

# Remove all unused Docker resources
docker system prune -a --volumes
```

## Default Credentials

### Admin User
- **Email**: [email protected]
- **Password**: admin123

### Database
- **Host**: localhost
- **Port**: 5432
- **Database**: lesmee_dev
- **Username**: postgres
- **Password**: postgres123

### Redis
- **Host**: localhost
- **Port**: 6379
- **Password**: redis123

## Troubleshooting

### Port Conflicts
If ports are already in use, modify them in `docker-compose.dev.yml`:
```yaml
ports:
- "5433:5432" # PostgreSQL on 5433
- "6380:6379" # Redis on 6380
```

### Permission Issues
If you encounter permission errors, ensure Docker has proper permissions and consider:
```bash
# Fix Docker permissions on Linux/Mac
sudo chown -R $USER:$USER ./
```

### Backend Build Issues
If backend fails to start:
1. Check logs: `docker-compose -f docker-compose.dev.yml logs backend`
2. Ensure `.env.dev` exists and is correctly configured
3. Try rebuilding: `docker-compose -f docker-compose.dev.yml up --build -d backend`

### Frontend Build Issues
If frontend fails to start:
1. Check logs: `docker-compose -f docker-compose.dev.yml logs frontend`
2. Ensure node_modules volume is properly mounted
3. Try rebuilding: `docker-compose -f docker-compose.dev.yml up --build -d frontend`

## Development Best Practices

1. **Use Version Control**: Commit changes frequently with descriptive messages
2. **Environment Variables**: Keep sensitive data in `.env.dev`, don't commit it
3. **Database Migrations**: Always create migrations for schema changes
4. **Code Quality**: Use linters and formatters configured in the project
5. **Testing**: Run tests before committing changes
6. **Documentation**: Update this file when making architectural changes

## Production Deployment

For production deployment, use the main `docker-compose.yml` file with Traefik reverse proxy, not this development setup.

## Need Help?

- Check the logs for detailed error messages
- Refer to the main project documentation
- Open an issue in the project repository
108 changes: 0 additions & 108 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,74 +58,6 @@ You can **just fork or clone** this repository and use it as is.

✨ It just works. ✨

### How to Use a Private Repository

If you want to have a private repository, GitHub won't allow you to simply fork it as it doesn't allow changing the visibility of forks.

But you can do the following:

- Create a new GitHub repo, for example `my-full-stack`.
- Clone this repository manually, set the name with the name of the project you want to use, for example `my-full-stack`:

```bash
git clone [email protected]:fastapi/full-stack-fastapi-template.git my-full-stack
```

- Enter into the new directory:

```bash
cd my-full-stack
```

- Set the new origin to your new repository, copy it from the GitHub interface, for example:

```bash
git remote set-url origin [email protected]:octocat/my-full-stack.git
```

- Add this repo as another "remote" to allow you to get updates later:

```bash
git remote add upstream [email protected]:fastapi/full-stack-fastapi-template.git
```

- Push the code to your new repository:

```bash
git push -u origin master
```

### Update From the Original Template

After cloning the repository, and after doing changes, you might want to get the latest changes from this original template.

- Make sure you added the original repository as a remote, you can check it with:

```bash
git remote -v

origin [email protected]:octocat/my-full-stack.git (fetch)
origin [email protected]:octocat/my-full-stack.git (push)
upstream [email protected]:fastapi/full-stack-fastapi-template.git (fetch)
upstream [email protected]:fastapi/full-stack-fastapi-template.git (push)
```

- Pull the latest changes without merging:

```bash
git pull --no-commit upstream master
```

This will download the latest changes from this template without committing them, that way you can check everything is right before committing.

- If there are conflicts, solve them in your editor.

- Once you are done, commit the changes:

```bash
git merge --continue
```

### Configure

You can then update configs in the `.env` files to customize your configurations.
Expand All @@ -152,46 +84,6 @@ python -c "import secrets; print(secrets.token_urlsafe(32))"

Copy the content and use that as password / secret key. And run that again to generate another secure key.

## How To Use It - Alternative With Copier

This repository also supports generating a new project using [Copier](https://copier.readthedocs.io).

It will copy all the files, ask you configuration questions, and update the `.env` files with your answers.

### Install Copier

You can install Copier with:

```bash
pip install copier
```

Or better, if you have [`pipx`](https://pipx.pypa.io/), you can run it with:

```bash
pipx install copier
```

**Note**: If you have `pipx`, installing copier is optional, you could run it directly.

### Generate a Project With Copier

Decide a name for your new project's directory, you will use it below. For example, `my-awesome-project`.

Go to the directory that will be the parent of your project, and run the command with your project's name:

```bash
copier copy https://github.com/fastapi/full-stack-fastapi-template my-awesome-project --trust
```

If you have `pipx` and you didn't install `copier`, you can run it directly:

```bash
pipx run copier copy https://github.com/fastapi/full-stack-fastapi-template my-awesome-project --trust
```

**Note** the `--trust` option is necessary to be able to execute a [post-creation script](https://github.com/fastapi/full-stack-fastapi-template/blob/master/.copier/update_dotenv.py) that updates your `.env` files.

### Input Variables

Copier will ask you for some data, you might want to have at hand before generating the project.
Expand Down
Loading
Loading