|
| 1 | +# Learn Faust.js |
| 2 | + |
| 3 | +Next.js app to be used with the [Learn Faust tutorial](https://faustjs.org/docs/tutorial/learn-faust/). |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Node.js (v18+ recommended) |
| 8 | +- [Docker](https://www.docker.com/) (required for running WordPress with wp-env) |
| 9 | + |
| 10 | +**Note:** Make sure Docker is running before starting (`docker ps`) |
| 11 | + |
| 12 | +## Quick Start |
| 13 | + |
| 14 | +1. **Install dependencies** |
| 15 | + ```bash |
| 16 | + npm install |
| 17 | + ``` |
| 18 | + |
| 19 | +2. **Set up environment variables** |
| 20 | + |
| 21 | + Copy the example file and configure: |
| 22 | + ```bash |
| 23 | + cp .env.local.example .env.local |
| 24 | + ``` |
| 25 | + |
| 26 | +3. **Start WordPress and the development server** |
| 27 | + ```bash |
| 28 | + npm run tutorial:setup # First time setup |
| 29 | + npm run tutorial:start # Start WordPress and Next.js dev server |
| 30 | + ``` |
| 31 | + |
| 32 | +4. **Access the application** |
| 33 | + - Frontend: [http://localhost:3000/](http://localhost:3000/) |
| 34 | + - WordPress Admin: [http://localhost:8888/wp-admin/](http://localhost:8888/wp-admin/) |
| 35 | + |
| 36 | + > **Default credentials:** username: `admin`, password: `password` |
| 37 | +
|
| 38 | +5. **Configure Faust in WordPress** |
| 39 | + |
| 40 | + Follow the tutorial at [faustjs.org/docs/tutorial/learn-faust/](https://faustjs.org/docs/tutorial/learn-faust/) to complete the setup. |
| 41 | + |
| 42 | +## Available Commands |
| 43 | + |
| 44 | +| Command | Description | |
| 45 | +| ------------------ | -------------------------------------------------------------- | |
| 46 | +| `tutorial:setup` | Initial setup: installs packages, starts wp-env, imports DB | |
| 47 | +| `tutorial:start` | Starts WordPress and the Next.js development server | |
| 48 | +| `tutorial:stop` | Stops the WordPress environment | |
| 49 | +| `tutorial:prune` | Rebuilds everything from scratch | |
| 50 | +| `wp:start` | Starts the WordPress environment | |
| 51 | +| `wp:stop` | Stops the WordPress environment | |
| 52 | +| `wp:destroy` | Completely removes the WordPress environment | |
| 53 | +| `wp:db:query` | Executes a database query within the WordPress environment | |
| 54 | +| `wp:db:export` | Exports the WordPress database to `wp-env/db/database.sql` | |
| 55 | +| `wp:db:import` | Imports the WordPress database from `wp-env/db/database.sql` | |
| 56 | +| `dev` | Runs the Next.js development server only | |
| 57 | +| `build` | Builds the Next.js application for production | |
| 58 | + |
| 59 | +## Project Structure |
| 60 | + |
| 61 | +``` |
| 62 | +├── src # Next.js application source |
| 63 | +├── .wp-env.json # wp-env configuration file |
| 64 | +└── wp-env |
| 65 | + ├── db |
| 66 | + │ └── database.sql # WordPress database with pre-configured settings |
| 67 | + ├── setup |
| 68 | + │ └── .htaccess # CORS configuration |
| 69 | + └── uploads # WordPress uploads directory |
| 70 | +``` |
| 71 | + |
| 72 | +## Learn More |
| 73 | + |
| 74 | +For detailed step-by-step instructions, visit the [Learn Faust tutorial](https://faustjs.org/docs/tutorial/learn-faust/). |
0 commit comments