|
1 | | -```ts |
2 | | -// WHOAMI |
3 | | -export const metadata: Metadata = { |
4 | | - title: 'Moonlitgrace', |
5 | | - description: |
6 | | - 'Step into Moonlitgrace, where a passionate web developer and |
7 | | - open-source contributor shares insights, projects, and |
8 | | - creativity—all under the alias Moonlitgrace.', |
9 | | -}; |
10 | | -``` |
| 1 | +# moonlitgrace.space |
11 | 2 |
|
12 | | -## Development |
| 3 | +Step into Moonlitgrace, where a passionate web developer and open-source contributor shares insights, projects, and creativity—all under the alias Moonlitgrace. |
13 | 4 |
|
14 | | -This is a containerized next.js app, so I recommend you to run it with docker or podman. |
| 5 | +### Table of Contents |
15 | 6 |
|
16 | | -> [!IMPORTANT] |
17 | | -> You can use [docker](https://www.docker.com/) or [podman](https://podman.io/)\ |
18 | | -> Here I will show you with podman. |
| 7 | + - [Development](#development) |
| 8 | + - [Basic Steps](#basic-steps) |
| 9 | + - [Configure environment variables](#configure-environment-variables) |
| 10 | + - [Run app on local](#run-app-on-local-traditional-workflow) |
| 11 | + - [Run app on container](#run-app-on-container) |
19 | 12 |
|
| 13 | +## Development |
20 | 14 | ### Basic Steps |
21 | 15 |
|
22 | | -- `git clone https://github.com/moonlitgrace/space moonlitspace` |
23 | | -- `cd moonlitspace` |
| 16 | +- `git clone https://github.com/moonlitgrace/moonlitgrace.space moonlitgrace.space` |
| 17 | +- `cd moonlitgrace.space` |
24 | 18 | - `npm i` |
25 | 19 |
|
26 | 20 | ### Configure environment variables |
27 | 21 |
|
28 | 22 | From repo you will get 3 `.env` files such as: |
29 | 23 |
|
30 | | -- `.env.development` |
31 | 24 | - `.env.example` |
| 25 | +- `.env.development` |
32 | 26 | - `.env.local.example` |
33 | 27 |
|
34 | | -For development you only have to change `.env.local.example` like: |
| 28 | +Check [Environment Variable Load Order](https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables#environment-variable-load-order) for more information regarding this structure. |
35 | 29 |
|
36 | | -- First create `.env.local` with: |
37 | | - `cp .env.local.example .env.local` |
38 | | - |
39 | | -For `SECRET_KEY` you can use anything since it is for development. You can use this `openssl rand -base64 32` to create for production. |
| 30 | +For `SECRET_KEY` you can use anything since it is for development. (You can use this `openssl rand -base64 32` to create for production.) |
40 | 31 |
|
41 | 32 | As for `ADMIN_USERNAME` and `ADMIN_PASSWORD` add something to authenticate only you. |
42 | 33 |
|
43 | | -### Run containers |
| 34 | +`DATABASE_URL`: uncomment value according to your selected workflow (see next heading). |
| 35 | + |
| 36 | +## Run app on local (traditional workflow) |
| 37 | + |
| 38 | +Before running `app`, we need a postgres `db` running.\ |
| 39 | +You can either run `db` on your system or use docker/podman. |
44 | 40 |
|
45 | | -After setting required env variables, let's start containers with one command:\ |
46 | | -`podman-compose -f docker-compose.dev.yml up -d --build` |
| 41 | +eg postgresql connection string format: `postgresql://[db_user[:db_password]@][db_host][:db_port]/[db_name]` |
| 42 | + |
| 43 | +If you've docker/podman installed, you can run `db` on a container with command: |
| 44 | +```bash |
| 45 | +# docker compose -f docker-compose.db.yml up |
| 46 | +podman compose -f docker-compose.db.yml up |
| 47 | +``` |
| 48 | + |
| 49 | +Now `db` is up!\ |
| 50 | +Next run database migrations with commands: |
| 51 | +```bash |
| 52 | +# can use any package manager |
| 53 | +npm run db:generate |
| 54 | +npm run db:migrate |
| 55 | +``` |
| 56 | + |
| 57 | +If you want some mock data for development: run: `npm run db:seed` |
| 58 | + |
| 59 | +To get `next.js` app running, run this command: |
| 60 | +```bash |
| 61 | +npm run dev |
| 62 | +``` |
| 63 | + |
| 64 | +And that's for now! check [localhost:3000](https://localhost:3000) to see app running! |
| 65 | + |
| 66 | +## Run app on container |
| 67 | + |
| 68 | +(un)fortunately this app is containerized, so you can easily run it with docker/podman/any(idk).\ |
| 69 | +Just run this command: |
| 70 | +```bash |
| 71 | +# docker compose -f docker-compose.dev.yml up --build |
| 72 | +podman compose -f docker-compose.dev.yml up --build |
| 73 | +``` |
47 | 74 |
|
48 | | -And that's it, docker will setup everything for you, and once its done, visit: `http://localhost:3000`\ |
| 75 | +This will run app on [localhost:3000](https://localhost:3000), hurray? |
49 | 76 |
|
50 | | -Consider [issue tracker](https://github.com/moonlitgrace/space/issues) if you see any problem setting it up, happy coding! |
| 77 | +> Next.js on container is not fun imho.\ |
| 78 | +> recommended: local setup |
0 commit comments