Skip to content

Commit 154d448

Browse files
authored
Merge pull request #188 from platformatic/fix/broken-redirects-on-build
2 parents 3d47ac7 + 43b18ea commit 154d448

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+693
-215
lines changed

docs/contributing/documentation-style-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ More like this:
124124
>As an example, the following recommendations should be
125125
referenced.
126126

127-
To view a live example, refer to the [Decorators](../db/configuration.md)
127+
To view a live example, refer to the [Decorators](../packages/db/configuration.md)
128128
reference document.
129129

130130
To recap, **avoid "you" in reference documentation or API documentation.**

docs/file-formats.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ Platformatic supports the following file formats, their file extensions and the
2222
| TOML | `.tml`, `.toml` | Yes |
2323

2424

25-
#### [Back to docs](../docs/composer/configuration.md#configuration-files)
25+
#### [Back to docs](./packages/composer/configuration.md#configuration-files)

docs/getting-started/new-api-project-instructions.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ This interactive command-line tool will guide you through setting up a new Platf
3131

3232
```
3333
- Where would you like to create your project? => .
34+
- Which package manager do you want to use? => npm
3435
- Which kind of service do you want to create? => @platformatic/db
3536
- What is the name of the service? => (generated-randomly), e.g. legal-soup
3637
- What is the connection string? => sqlite://./db.sqlite
@@ -45,6 +46,8 @@ After completing the wizard, your Platformatic application will be ready in the
4546

4647
:::note
4748

48-
If the wizard does not handle dependency installation, ensure to run `npm/yarn/pnpm` install command manually:
49+
If the wizard does not handle dependency installation, ensure to run `npm/yarn/pnpm` install command manually.
50+
51+
`wattpm` sets up workspaces for the selected package manager. Running a manual installation with a different package manager may cause issues or trigger warnings.
4952

5053
:::

docs/getting-started/quick-start-guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import SetupWatt from './setup-watt.md';
66

77
# Fullstack Guide
88

9-
Welcome to your next steps with Platformatic services such as [Platformatic Watt](/docs/watt/overview.md), [Platformatic DB](/docs/db/overview.md) with [SQLite](https://www.sqlite.org/), [Platformatic Client](/docs/client/overview.md) and the [Platformatic Composer](/docs/composer/overview.md).
9+
Welcome to your next steps with Platformatic services such as [Platformatic Watt](../packages/watt/overview.md), [Platformatic DB](../packages/db/overview.md) with [SQLite](https://www.sqlite.org/), [Platformatic Client](../packages/client/overview.md) and the [Platformatic Composer](../packages/composer/overview.md).
1010

1111
In this tutorial, you will build a movie quotes application, where users can add, like and delete quotes from popular movies. This guide will help you setup and run your first full-stack Platformatic application.
1212

1313
:::note
1414

15-
While this guide uses [SQLite](https://www.sqlite.org/), Platformatic DB also supports [PostgreSQL](https://www.postgresql.org/), [MySQL](https://www.mysql.com/), and [MariaDB](https://mariadb.org/). For more details on database compatibility, see the [Platformatic DB documentation](/docs/db/overview.md#supported-databases).
15+
While this guide uses [SQLite](https://www.sqlite.org/), Platformatic DB also supports [PostgreSQL](https://www.postgresql.org/), [MySQL](https://www.mysql.com/), and [MariaDB](https://mariadb.org/). For more details on database compatibility, see the [Platformatic DB documentation](../packages/db/overview.md#supported-databases).
1616

1717
:::
1818

@@ -147,7 +147,7 @@ npx platformatic db migrations apply
147147

148148
## Add a Composer service
149149

150-
[Platformatic Composer](/docs/composer/overview.md) integrates different microservices into a single API for more efficient management. For the movie quotes application, you will use the Platformatic composer to aggregate the DB service, and your frontend application.
150+
[Platformatic Composer](../packages/composer/overview.md) integrates different microservices into a single API for more efficient management. For the movie quotes application, you will use the Platformatic composer to aggregate the DB service, and your frontend application.
151151

152152
Inside `web` folder, let's create a new Platformatic Composer
153153

docs/getting-started/quick-start-watt.md

Lines changed: 36 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ This guide will help you set up and run an application composed of the following
99
- [Platformatic Composer](/docs/reference/composer/introduction), to coordinate/expose them all.
1010

1111
:::note
12-
1312
In this guide, we will use `Next.js` as our frontend framework, but you can also use [Astro](https://astro.build/),
1413
or [Remix](https://remix.run/). We plan to expand the list of supported frameworks in the future.
15-
1614
:::
1715

1816

@@ -26,106 +24,76 @@ Before starting, ensure you have the following installed:
2624
## Set up Watt
2725

2826
```bash
29-
mkdir my-app
30-
cd my-app
3127
npx wattpm@latest init
3228
```
3329

3430
Which will output:
35-
3631
```
37-
Need to install the following packages:
38-
39-
Ok to proceed? (y) y
40-
41-
[15:48:14.722] DONE (40803): Created a wattpm application in /Users/matteo/tmp/my-app.
32+
Hello YOUR_NAME, welcome to Watt 2.70.1!
33+
? Where would you like to create your project? .
34+
? Which kind of service do you want to create? @platformatic/service
35+
✔ Installing @platformatic/service@^2.70.1 using npm ...
36+
? What is the name of the service? my-app
37+
? Do you want to create another service? no
38+
? Do you want to use TypeScript? no
39+
? What port do you want to use? 3042
4240
```
4341

44-
Then, run `npm install` to install all the dependencies.
42+
Dependencies are going to be installed. Your application is located in `web/my-app`.
43+
The `watt.json` file is automatically created in the `my-app` folder, and the `package.json` file includes a `start` script and `@platformatic/node` as a dependency.
4544

4645
## Add your first Node.js application to Watt
4746

48-
Inside `my-app`, create a new directory and add a simple Node.js app:
49-
50-
```bash
51-
mkdir web/node
52-
```
53-
54-
Then add a `package.json` like the following:
55-
56-
```json
57-
{
58-
"main": "server.js",
59-
"type": "module",
60-
"dependencies": {
61-
"@platformatic/node": "^2.0.0"
62-
}
63-
}
64-
```
47+
By choosing the `@platformatic/node` service, you have already created your nodejs app.
6548

66-
Then, create a `web/node/server.js` file with the following content:
49+
This file is created as your nodejs app:
6750

6851
```js
69-
import { createServer } from 'node:http';
70-
71-
export function build () {
72-
let count = 0
52+
import { createServer } from 'node:http'
7353

74-
const server = createServer((req, res) => {
75-
console.log('received request', req.url)
76-
res.setHeader('Content-Type', 'application/json');
77-
res.end(JSON.stringify({ content: `from node:http createServer: ${count++}!` }));
54+
export function create() {
55+
return createServer((req, res) => {
56+
res.writeHead(200, { 'content-type': 'application/json', connection: 'close' })
57+
res.end(JSON.stringify({ hello: 'world' }))
7858
})
79-
80-
return server
8159
}
8260
```
8361

8462
:::note
85-
8663
In this example, we are using the built-in `node:http` module to
8764
create a simple HTTP server that responds with a JSON object containing a counter.
8865
You can see that we are returning a `build` function that creates the server.
8966
This server will be run by Watt when the application starts in its
9067
own worker thread.
68+
:::
9169

9270
You can also use [Express](https://expressjs.com/), [Fastify](https://fastify.dev), [Koa](https://koajs.com/)
9371
or any other Node.js framework.
9472

95-
:::
96-
97-
98-
Then, we need to add the `watt.json` config file by running:
99-
100-
```bash
101-
wattpm import web/node
102-
```
103-
104-
Let's install the dependencies in the root of the project with
105-
106-
107-
```bash
108-
npm install
109-
```
110-
11173
### Start your Watt server
11274

113-
Run the following command in your project directory to start your Watt server:
75+
Run the following command in the root of project to start your Watt server:
11476

11577
```bash
11678
npm start
11779
```
11880

11981
This will internally run `wattpm start` and start your Watt server.
12082

121-
If you want to have have a "watch mode" to automatically restart the server when you make changes, you can run:
83+
:::note
84+
85+
running `npm run start` at the root directory is running the watt server. if you run `npm run start` at the service directory(in this case `web/my-app`) it is running that single service via this command from the service package.json script: `start-platformatic-node`
86+
87+
:::
88+
89+
If you want to have a "watch mode" to automatically restart the server when you make changes, you can run this command in the root directory:
12290

12391
```bash
12492
npm run dev
12593
```
126-
12794
Which will run `wattpm dev` and start your Watt server in watch mode.
12895

96+
12997
Your first Watt server is now live! 🌟 You can test it with:
13098

13199
```bash
@@ -165,10 +133,17 @@ Using existing configuration ...
165133

166134
Start your Watt server again:
167135

136+
You can run these commands in the root directory:
168137
```bash
169138
npm start
170139
```
171140

141+
If you want to have a "watch mode" to automatically restart the server when you make changes, you can run this command in the root directory:
142+
```bash
143+
npm run dev
144+
```
145+
Which will run `wattpm dev` and start your Watt server in watch mode.
146+
172147
Then, you can test it with:
173148

174149
```bash
@@ -177,8 +152,8 @@ curl http://localhost:3042/node
177152

178153
:::note
179154

180-
You can customize how the various services are expsed by changing `web/composer/platformatic.json`.
181-
Here is the equivalent of the default configuration when exposing a Node.js application:
155+
You can customize how the various services are exposed by changing `web/composer/platformatic.json`.
156+
Here is the equivalent of the default configuration when exposing a Node.js application:
182157

183158
```json
184159
{

docs/guides/deployment/compiling-typescript.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Compiling Typescript for Deployment
22

3-
[Platformatic Service](/service/overview.md), Composer, and DB provide automatic TypeScript compilation during the startup
3+
[Platformatic Service](../../packages/service/overview.md), Composer, and DB provide automatic TypeScript compilation during the startup
44
of your Node.js server. While this provides an amazing developer experience, in production it adds additional
55
start time, and it requires more resources. In this guide, we show how to compile your TypeScript
66
source files before shipping to a server.
77

88
## Setup
99

10-
The following is supported by all Platformatic applications, as they are all based on the same [plugin system](/service/plugin.md).
10+
The following is supported by all Platformatic applications, as they are all based on the same [plugin system](../../packages/service/plugin.md).
1111
If you have generated your application using `npx wattpm create`, you will have a similar section in your config file:
1212

1313
```json
@@ -39,7 +39,7 @@ Remember to set `PLT_TYPESCRIPT=false` in your environment variables in the depl
3939

4040
## Usage with Runtime
4141

42-
If you are building a [Runtime](/runtime/overview.md)-based application, you will need
42+
If you are building a [Runtime](../../packages/runtime/overview.md)-based application, you will need
4343
to compile every service independently or use the `plt runtime compile` command.
4444

4545
## Avoid shipping TypeScript sources

docs/guides/logger/services/next/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"react": "^19.0.0",
13-
"react-dom": "^19.0.0",
14-
"next": "15.3.3",
12+
"react": "^19.1.0",
13+
"react-dom": "^19.1.0",
14+
"next": "15.3.5",
1515
"@platformatic/next": "^2.61.0"
1616
}
1717
}

docs/guides/monitoring.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ Prometheus recommends using a port different from the main application port for
3838
...
3939
```
4040

41-
All the configuration settings are optional. To use the default settings, set `"metrics": true`. See the [configuration reference](../db/configuration.md#metrics) for more details.md#metrics
41+
All the configuration settings are optional. To use the default settings, set `"metrics": true`. See the [configuration reference](../packages/db/configuration.md#metrics) for more details.md#metrics
4242

4343
:::caution
44-
Use [environment variable placeholders](../service/configuration.md#environment-variable-placeholders) in your Platformatic DB configuration file to avoid exposing credentials.
44+
Use [environment variable placeholders](../packages/service/configuration.md#environment-variable-placeholders) in your Platformatic DB configuration file to avoid exposing credentials.
4545
:::
4646

4747
## Custom Metrics

docs/learn/beginner/crud-application.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import SetupWatt from '../../getting-started/setup-watt.md';
88

99
# Build a Todo API with Platformatic Watt and DB
1010

11-
In this tutorial, you will build a simple ToDo application using the [Platformatic Watt](../../watt/overview.md) and [DB](../../db/overview.md). Platformatic DB makes it easier to create endpoints that return data from a database application. It automatically generates REST/GraphQL endpoints by mapping your database and then exposes these endpoints to your API consumers.
11+
In this tutorial, you will build a simple ToDo application using the [Platformatic Watt](../../packages/watt/overview.md) and [DB](../../packages/db/overview.md). Platformatic DB makes it easier to create endpoints that return data from a database application. It automatically generates REST/GraphQL endpoints by mapping your database and then exposes these endpoints to your API consumers.
1212

1313
This guide will walk you through the steps to build Todo CRUD API with Platformatic services, highlighting the differences compared to building traditional APIs.
1414

1515
## Prerequisites
1616
Before we begin, make sure you have the following installed:
1717

1818
- [Node.js](https://nodejs.org/) (v20.16.0+ or v22.3.0+)
19-
- [Platformatic CLI](../../cli.md)
19+
- [Platformatic CLI](../../packages/platformatic/cli.md)
2020

2121
## Building a Todo API
2222

@@ -26,7 +26,7 @@ Let's get started!
2626

2727
## Setting Up the Project
2828

29-
Before you create the database for the Todo application, first setup [Platformatic Watt](../../watt/overview.md), the Node.js application server. Run the command to setup Watt:
29+
Before you create the database for the Todo application, first setup [Platformatic Watt](../../packages/watt/overview.md), the Node.js application server. Run the command to setup Watt:
3030

3131
<SetupWatt />
3232

@@ -47,7 +47,7 @@ npm start
4747

4848
Platformatic DB uses [SQLite](https://www.sqlite.org/) as the default database for any Platformatic DB application, you can see the SQL definition in the `.env` file in the root folder of your application.
4949

50-
For the Todo API, we need two tables, Users and Todos, let's edit the migrations generated by [Platformatic CLI](../../cli.md) to add these tables:
50+
For the Todo API, we need two tables, Users and Todos, let's edit the migrations generated by [Platformatic CLI](../../packages/platformatic/cli.md) to add these tables:
5151

5252
### Creating a Users table
5353

@@ -92,7 +92,7 @@ DROP TABLE Todos;
9292
```
9393

9494
:::note
95-
See the [Glossary](../glossary.md) for terminologies and definitions used in [Platformatic DB](../../db/overview.md).
95+
See the [Glossary](../glossary.md) for terminologies and definitions used in [Platformatic DB](../../packages/db/overview.md).
9696
:::
9797

9898
Now let's apply the migrations we just created by running the command below:
@@ -101,7 +101,7 @@ Now let's apply the migrations we just created by running the command below:
101101
npx platformatic db migrations apply
102102
```
103103

104-
Notice that after running migrations, you get a `global.d.ts` and a types folder with all our types and interfaces automatically generated by [Platformatic DB](../../db/overview.md). The `global.d.ts` file is used for querying the Platformatic database.
104+
Notice that after running migrations, you get a `global.d.ts` and a types folder with all our types and interfaces automatically generated by [Platformatic DB](../../packages/db/overview.md). The `global.d.ts` file is used for querying the Platformatic database.
105105

106106
Now, start your Platformatic DB application by running:
107107

@@ -169,4 +169,4 @@ origin to make requests to our API.
169169

170170
## Conclusion
171171

172-
Congratulations! You have successfully created a simple Todo API using Platformatic. This tutorial covered the basics of setting up a Platformatic project, defining a schema, configuring the service, and creating API endpoints. For more advanced features and configurations, refer to the [Platformatic API Documentation](../../cli.md).
172+
Congratulations! You have successfully created a simple Todo API using Platformatic. This tutorial covered the basics of setting up a Platformatic project, defining a schema, configuring the service, and creating API endpoints. For more advanced features and configurations, refer to the [Platformatic API Documentation](../../packages/platformatic/cli.md).

docs/learn/glossary.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ label: A comprehensive glossary of terms and terminologies associated with Platf
1818
## C
1919

2020
**CLI (Command Line Interface)**
21-
- A tool for interacting with Platformatic via text commands. The [Platformatic CLI](../cli.md) simplifies managing services and configurations.
21+
- A tool for interacting with Platformatic via text commands. The [Platformatic CLI](../packages/platformatic/cli.md) simplifies managing services and configurations.
2222

2323
**CRUD (Create, Read, Update, Delete)**
2424
- Basic operations for managing data. Platformatic automates CRUD operations for API endpoints based on schemas.
@@ -114,7 +114,7 @@ label: A comprehensive glossary of terms and terminologies associated with Platf
114114

115115
**Service**
116116
- A dedicated infrastructure layer for managing service-to-service communication. Platformatic can integrate with service meshes for advanced microservice management.
117-
- A Platformatic [Service](../service/overview.md) is an HTTP server based on [Fastify](https://fastify.dev) that allows developers to build robust APIs with Node.js.
117+
- A Platformatic [Service](../packages/service/overview.md) is an HTTP server based on [Fastify](https://fastify.dev) that allows developers to build robust APIs with Node.js.
118118

119119
## T
120120

0 commit comments

Comments
 (0)