SolidStart
Step 1: Create a New SolidStart Project
Run the following command to initialize a new SolidStart project:
npm init solid@latest remult-solid-startAnswer the prompts as follows:
o Is this a Solid-Start project? Yes
o Which template would you like to use? basic
o Use TypeScript? YesOnce completed, navigate to the project directory:
cd remult-solid-startStep 2: Install Remult
To install the Remult package, run:
npm i remultStep 3: Bootstrap Remult in the Backend
Remult is integrated into SolidStart using a catch-all dynamic API route, which passes API requests to a handler created using the remultApi function.
Create the Remult API Configuration File
In the
srcdirectory, create a file namedapi.tswith the following code:ts// src/api.ts import { remultApi } from 'remult/remult-solid-start' export const api = remultApi({})Set Up the Catch-All API Route
In the
src/routes/api/directory, create a file named[...remult].tswith the following code:ts// src/routes/api/[...remult].ts import { api } from '../../api.js' export const { POST, PUT, DELETE, GET } = api
Step 4: Enable TypeScript Decorators
Install Babel Plugins for Decorators:
shnpm i -D @babel/plugin-proposal-decorators @babel/plugin-transform-class-propertiesConfigure Babel Plugins in SolidStart:
Add the following configuration to the
app.config.tsfile to enable TypeScript decorators:ts// app.config.ts import { defineConfig } from "@solidjs/start/config" export default defineConfig({ //@ts-ignore solid: { babel: { plugins: [ ["@babel/plugin-proposal-decorators", { version: "legacy" }], ["@babel/plugin-transform-class-properties"], ], }, }, })
Setup Complete
Your SolidStart project is now set up with Remult and ready to run. You can now proceed to the next steps of building your application.