Skip to content

Commit 16ed4f0

Browse files
authored
Merge pull request #102 from strapi/update/readme
Update Readme
2 parents 281d2d7 + ebdf5a4 commit 16ed4f0

File tree

7 files changed

+84
-57
lines changed

7 files changed

+84
-57
lines changed

README.md

Lines changed: 32 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -14,91 +14,75 @@ Strap yourself in! You can get started with this project on your local machine b
1414

1515
## 1. Clone Launchpad
1616

17-
To infinity and beyond! 🚀 Clone the repo with this command:
17+
To infinity and beyond! 🚀 Before you take off, clone the repo and set it up:
1818

19-
```
19+
```sh
2020
git clone https://github.com/strapi/launchpad.git
21+
cd launchpad
22+
yarn
23+
yarn run setup
2124
```
2225

23-
- Navigate to your project folder by running `cd launchpad`.
24-
25-
## 2. Set up environment variables
26+
This will clone the repo, install dependencies in both projects (Strapi and Next.js), and run the `setup` scripts to get you started.
2627

27-
Before you take off, set up the required environment variables for both Strapi and Next.js.
28+
## 2. Start Strapi
2829

29-
To create the Strapi .env file, copy the content of the `./strapi/.env.example` file into a new file named `./strapi/.env`, then modify the values to match your setup:
30+
Navigate to your `./launchpad/strapi` folder and start the server:
3031

3132
```sh
32-
cp ./strapi/.env.example ./strapi/.env
33-
```
34-
35-
Then do the same for the Next.js .env file, and modify it too:
36-
37-
```sh
38-
cp ./next/.env.example ./next/.env
39-
```
40-
41-
## 3. Start Strapi
42-
43-
Take a deep breath. It's time to power up the Strapi engines. Navigate to your ./my-projects/launchpad/strapi folder by running:
44-
45-
Navigate to your `./my-projects/launchpad/strapi` folder by running `cd strapi` from your command line.
46-
47-
- Run the following command in your `./launchpad/strapi` folder:
48-
49-
```
50-
yarn && yarn seed && yarn develop
33+
cd strapi
34+
yarn dev
5135
```
5236

53-
This will install dependencies, sprinkle in some data magic, and run the server. (You can run these commands separately, but why not be efficient?)
37+
This will install dependencies, sprinkle in some data magic, and run the server.
5438

55-
## 4. Start Next.js
39+
## 3. Start Next.js
5640

5741
We're almost ready for lift-off! Next.js is your sleek, futuristic interface for getting all that glorious content out into the world. 🚀
5842

59-
Open a new terminal tab or window to leave Strapi running, and navigate to your `./my-projects/launchpad/next` folder by running `cd next`.
43+
Open a new terminal tab or window to leave Strapi running, and navigate to your `./launchpad/next` and start the server:
6044

61-
- Run the following command in your `./launchpad/next` folder
62-
63-
```
64-
yarn && yarn build && yarn start
45+
```sh
46+
cd next
47+
yarn dev
6548
```
6649

6750
This installs dependencies, builds your project, and starts your server. You’re now a spacefaring content master!
6851

52+
You're all set! Visit http://localhost:1337/admin to create your first Strapi user, and http://localhost:3000 to discover your space rocket website.
53+
6954
## Features Overview ✨
7055

7156
### User
7257

7358
<br />
7459

75-
**An intuitive, minimal editor** The editor allows you to pull in dynamic blocks of content. It’s 100% open-source, and it’s fully extensible.<br />
76-
**Media Library** Upload images, video or any files and crop and optimize their sizes, without quality loss.<br />
77-
**Flexible content management** Build any type of category, section, format or flow to adapt to your needs. <br />
78-
**Sort and Filter** Built-in sorting and filtering: you can manage thousands of entries without effort.<br />
79-
**User-friendly interface** The most user-friendly open-source interface on the market.<br />
80-
**SEO optimized** Easily manage your SEO metadata with a repeatable field and use our Media Library to add captions, notes, and custom filenames to optimize the SEO of media assets.<br /><br />
60+
- **An intuitive, minimal editor** The editor allows you to pull in dynamic blocks of content. It’s 100% open-source, and it’s fully extensible.<br />
61+
- **Media Library** Upload images, video or any files and crop and optimize their sizes, without quality loss.<br />
62+
- **Flexible content management** Build any type of category, section, format or flow to adapt to your needs. <br />
63+
- **Sort and Filter** Built-in sorting and filtering: you can manage thousands of entries without effort.<br />
64+
- **User-friendly interface** The most user-friendly open-source interface on the market.<br />
65+
- **SEO optimized** Easily manage your SEO metadata with a repeatable field and use our Media Library to add captions, notes, and custom filenames to optimize the SEO of media assets.<br /><br />
8166

8267
### Global
8368

8469
<br />
8570

86-
[Customizable API](https://strapi.io/features/customizable-api): Automatically build out the schema, models, controllers for your API from the editor. Get REST or GraphQL API out of the box without writing a single line of code.<br />
87-
[Media Library](https://strapi.io/features/media-library): The media library allows you to store your images, videos and files in your Strapi admin panel with many ways to visualize and manage them.<br />
88-
[Role-Based Access Control (RBAC)](https://strapi.io/features/custom-roles-and-permissions): Role-Based Access Control is a feature available in the Administration Panel settings that let your team members have access rights only to the information they need.<br />
89-
[Internationalization (i18n)](https://strapi.io/features/internationalization): Internationalization (i18n) lets you create many content versions, also called locales, in different languages and for different countries.<br />
90-
[Audit Logs](https://strapi.io/blog/reasons-and-best-practices-for-using-audit-logs-in-your-application)The Audit Logs section provides a searchable and filterable display of all activities performed by users of the Strapi application<br />
91-
[Data transfer](https://strapi.io/blog/importing-exporting-and-transferring-data-with-the-strapi-cli) Streams your data from one Strapi instance to another Strapi instance.<br />
92-
[Review Worfklows](https://docs.strapi.io/user-docs/settings/review-workflows) Create and manage any desired review stages for your content, enabling your team to collaborate in the content creation flow from draft to publication. <br />
71+
- [Customizable API](https://strapi.io/features/customizable-api): Automatically build out the schema, models, controllers for your API from the editor. Get REST or GraphQL API out of the box without writing a single line of code.<br />
72+
- [Media Library](https://strapi.io/features/media-library): The media library allows you to store your images, videos and files in your Strapi admin panel with many ways to visualize and manage them.<br />
73+
- [Role-Based Access Control (RBAC)](https://strapi.io/features/custom-roles-and-permissions): Role-Based Access Control is a feature available in the Administration Panel settings that let your team members have access rights only to the information they need.<br />
74+
- [Internationalization (i18n)](https://strapi.io/features/internationalization): Internationalization (i18n) lets you create many content versions, also called locales, in different languages and for different countries.<br />
75+
- [Audit Logs](https://strapi.io/blog/reasons-and-best-practices-for-using-audit-logs-in-your-application): The Audit Logs section provides a searchable and filterable display of all activities performed by users of the Strapi application<br />
76+
- [Data transfer](https://strapi.io/blog/importing-exporting-and-transferring-data-with-the-strapi-cli): Streams your data from one Strapi instance to another Strapi instance.<br />
77+
- [Review Worfklows](https://docs.strapi.io/user-docs/settings/review-workflows): Create and manage any desired review stages for your content, enabling your team to collaborate in the content creation flow from draft to publication. <br />
9378

9479
## Resources
9580

96-
[Docs](https://docs.strapi.io)[Demo](https://strapi.io/demo)[Forum](https://forum.strapi.io/)[Discord](https://discord.strapi.io)[Youtube](https://www.youtube.com/c/Strapi/featured)[Strapi Design System](https://design-system.strapi.io/)[Marketplace](https://market.strapi.io/)[Cloud Free Trial](https://cloud.strapi.io)
81+
[Docs](https://docs.strapi.io)[Discord](https://discord.strapi.io)[YouTube](https://www.youtube.com/c/Strapi/featured)[Strapi Design System](https://design-system.strapi.io/)[Marketplace](https://market.strapi.io/)[Cloud Free Trial](https://cloud.strapi.io)
9782

9883
## Todo
9984

10085
- [ ] Implement the official Strapi SEO plugin
101-
- [ ] Implement the community Strapi preview plugin
10286
- [ ] Create localized content for the pricing plans and products
10387
- [ ] Populate creator fields when it'll work on Strapi 5 (article authors information are missing)
10488

next/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ WEBSITE_URL=http://localhost:3000 # Add the correct ENV var for this onto your h
22
PORT=3000
33

44
NEXT_PUBLIC_API_URL=http://localhost:1337
5-
PREVIEW_SECRET=tobemodified
5+
PREVIEW_SECRET=preview_secret

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"prepare": "husky",
88
"next": "yarn dev --prefix ../next/",
99
"strapi": "yarn dev --prefix ../strapi/",
10-
"setup:next": "cd next && yarn && node --loader ts-node/esm ../scripts/copy-env.mts ./",
11-
"setup:strapi": "cd strapi && yarn && node --loader ts-node/esm ../scripts/copy-env.mts ./",
12-
"setup": "yarn install && yarn setup:next && yarn setup:strapi",
10+
"setup:next": "cd next && yarn && node --loader ts-node/esm ../scripts/copy-env.mts ../next",
11+
"setup:strapi": "cd strapi && yarn && node --loader ts-node/esm ../scripts/copy-env.mts ../strapi",
12+
"setup": "yarn && yarn setup:next && yarn setup:strapi",
1313
"dev": "yarn concurrently \"cd strapi && yarn develop\" \"npx wait-on http://localhost:1337 && cd next && yarn dev\"",
1414
"seed": "cd strapi && yarn strapi import -f ./data/export_20250116105447.tar.gz --force",
1515
"export": "cd strapi && yarn strapi export --no-encrypt -f ./data/export_20250116105447",
@@ -27,10 +27,12 @@
2727
},
2828
"devDependencies": {
2929
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
30+
"dotenv": "^17.2.3",
3031
"husky": "^9.1.7",
3132
"lint-staged": "^15.2.10",
3233
"prettier": "^3.5.3",
33-
"ts-node": "^10.9.2"
34+
"ts-node": "^10.9.2",
35+
"uuid": "^13.0.0"
3436
},
3537
"lint-staged": {
3638
"*.{js,jsx,ts,tsx,json,md,yml,yaml}": [

scripts/copy-env.mts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
import * as fs from 'fs';
22
import * as path from 'path';
3+
import { v4 as uuidv4 } from 'uuid';
4+
import dotenv from 'dotenv'
5+
6+
dotenv.config({ path: '../next/.env' })
7+
8+
const TO_BE_MODIFIED_KEY = /tobemodified/g;
9+
const PREVIEW_SECRET_KEY = 'preview_secret';
10+
11+
const generateSecret = () => uuidv4().replace(/-/g, '_');
12+
const previewSecret = process.env.PREVIEW_SECRET || generateSecret();
313

414
function copyEnvFile(targetDir: string): void {
515
// Ensure targetDir is trimmed
@@ -27,6 +37,19 @@ function copyEnvFile(targetDir: string): void {
2737
return;
2838
}
2939
console.log(`.env.example has been copied to ${envPath}`);
40+
41+
// Update env variables with generated secrets
42+
const currentEnv = fs.readFileSync(envPath, 'utf8');
43+
44+
// Replace all occurrences with a new secret
45+
const updatedEnv = currentEnv
46+
.replace(TO_BE_MODIFIED_KEY, generateSecret)
47+
.replace(PREVIEW_SECRET_KEY, previewSecret)
48+
49+
// Rewrite .env file with updated env variables
50+
fs.writeFileSync(envPath, updatedEnv, 'utf8');
51+
52+
console.log(`${envPath} has been updated with new secrets.`);
3053
});
3154
} else {
3255
// .env file exists, no action needed

strapi/.env.example

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
HOST=0.0.0.0
22
PORT=1337
3-
APP_KEYS="toBeModified1,toBeModified2"
3+
APP_KEYS="tobemodified1,tobemodified2"
44
API_TOKEN_SALT=tobemodified
55
ADMIN_JWT_SECRET=tobemodified
66
TRANSFER_TOKEN_SALT=tobemodified
77
JWT_SECRET=tobemodified
88

9-
109
CLIENT_URL=http://localhost:3000
11-
PREVIEW_SECRET=tobemodified # optional, required with Next.js draft mode
10+
PREVIEW_SECRET=preview_secret # optional, required with Next.js draft mode

strapi/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"description": "A Strapi application",
66
"scripts": {
77
"develop": "strapi develop",
8+
"dev": "strapi develop",
89
"start": "strapi start",
910
"build": "strapi build",
1011
"strapi": "strapi",
@@ -36,7 +37,7 @@
3637
"name": "A Strapi developer"
3738
},
3839
"strapi": {
39-
"uuid": "LAUNCHPAD-LOCAL"
40+
"uuid": "LAUNCHPAD"
4041
},
4142
"engines": {
4243
"node": ">=18.0.0 <=22.x.x",

yarn.lock

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,13 @@ __metadata:
519519
languageName: node
520520
linkType: hard
521521

522+
"dotenv@npm:^17.2.3":
523+
version: 17.2.3
524+
resolution: "dotenv@npm:17.2.3"
525+
checksum: 10c0/c884403209f713214a1b64d4d1defa4934c2aa5b0002f5a670ae298a51e3c3ad3ba79dfee2f8df49f01ae74290fcd9acdb1ab1d09c7bfb42b539036108bb2ba0
526+
languageName: node
527+
linkType: hard
528+
522529
"dunder-proto@npm:^1.0.1":
523530
version: 1.0.1
524531
resolution: "dunder-proto@npm:1.0.1"
@@ -1153,11 +1160,13 @@ __metadata:
11531160
"@trivago/prettier-plugin-sort-imports": "npm:^5.2.2"
11541161
"@types/node": "npm:^22.5.2"
11551162
concurrently: "npm:^8.2.2"
1163+
dotenv: "npm:^17.2.3"
11561164
husky: "npm:^9.1.7"
11571165
lint-staged: "npm:^15.2.10"
11581166
prettier: "npm:^3.5.3"
11591167
ts-node: "npm:^10.9.2"
11601168
typescript: "npm:^5.0.0"
1169+
uuid: "npm:^13.0.0"
11611170
wait-on: "npm:^8.0.1"
11621171
languageName: unknown
11631172
linkType: soft
@@ -1324,6 +1333,15 @@ __metadata:
13241333
languageName: node
13251334
linkType: hard
13261335

1336+
"uuid@npm:^13.0.0":
1337+
version: 13.0.0
1338+
resolution: "uuid@npm:13.0.0"
1339+
bin:
1340+
uuid: dist-node/bin/uuid
1341+
checksum: 10c0/950e4c18d57fef6c69675344f5700a08af21e26b9eff2bf2180427564297368c538ea11ac9fb2e6528b17fc3966a9fd2c5049361b0b63c7d654f3c550c9b3d67
1342+
languageName: node
1343+
linkType: hard
1344+
13271345
"v8-compile-cache-lib@npm:^3.0.1":
13281346
version: 3.0.1
13291347
resolution: "v8-compile-cache-lib@npm:3.0.1"

0 commit comments

Comments
 (0)