# Use and adapt e-store

Use the documented interfaces and source layout for **e-store**. The sections below retain the README’s examples and configuration details.

## Development

To spin up this example locally, follow the [Quick Start](/docs/up-to-code-e-store/quick-start). Then [Seed](#seed) the database with a few pages, posts, and projects.

### Docker

Alternatively, you can use [Docker](https://www.docker.com) to spin up this template locally. To do so, follow these steps:

1. Follow [steps 1 and 2 from above](/docs/up-to-code-e-store/development), the docker-compose file will automatically use the `.env` file in your project root
1. Next run `docker-compose up`
1. Follow [steps 4 and 5 from above](/docs/up-to-code-e-store/development) to login and create your first admin user

That's it! The Docker instance will help you get up and running quickly while also standardizing the development environment across your teams.

### Seed

To seed the database with a few pages, posts, and projects you can run `yarn seed`. This template also comes with a `GET /api/seed` endpoint you can use to seed the database from the admin panel.

The seed script will also create two users for demonstration purposes only:
1. Demo Author
    - Email: `demo-author@payloadcms.com`
    - Password: `password`
    - Role: `admin`
2. Demo User
    - Email: `demo-user@payloadcms.com`
    - Password: `password`
    - Role: `user`

> NOTICE: seeding the database is destructive because it drops your current database to populate a fresh one from the seed template. Only run this command if you are starting a new project or can afford to lose your current data.

## Commands in the root manifest

The captured [package.json](https://github.com/Up-to-code/e-store/blob/HEAD/package.json) declares the following scripts. Run them from the directory containing that manifest.

| Command | Script |
| --- | --- |
| `npm run dev` | `cross-env PAYLOAD_CONFIG_PATH=src/payload/payload.config.ts nodemon` |
| `npm run build` | `cross-env NODE_ENV=production yarn build:payload && yarn build:server && yarn copyfiles && yarn build:next` |
| `npm run serve` | `cross-env PAYLOAD_CONFIG_PATH=dist/payload/payload.config.js NODE_ENV=production node dist/server.js` |
| `npm run lint` | `eslint src` |

## Troubleshoot a local change

1. Reproduce the smallest example from the [quick-start guide](/docs/up-to-code-e-store/quick-start-guide).
2. Compare required configuration and dependency versions with the README.
3. Check the linked issue tracker for the same error. Include the command, runtime version, and relevant error when reporting a problem; omit credentials.

## Source and help

- [GitHub repository](https://github.com/Up-to-code/e-store)
- [Original README](https://github.com/Up-to-code/e-store/blob/main/README.md)
- [Issues and existing reports](https://github.com/Up-to-code/e-store/issues)
