Launch your DeFi app with this starter template, featuring SolidStart with server-side rendering capabilities and Web3Onboard for seamless Web3 integration with ethers.js.
- SSR Compliant: Web3 code loads only on the client, ensuring compatibility with SSR architecture
- Auth Context: A reactive context to monitor wallet changes, handle signatures, and more
- Database: Includes
unstorage, a lightweight file-based DB - Client-Only: Easily isolate client-side logic for Web3 interactions
-
Rename
.env.exampleto.env. For production, generate a secureSESSION_SECRETwithopenssl rand -hex 32
-
Install dependencies
# use preferred package manager npm install -
Run the development server
# use preferred package manager npm run dev
For more details, refer to SolidStart's README.md
To ensure Web3-related logic runs only on the client, use the clientOnly utility from SolidStart. Here are two ways to implement client-only code:
-
Client-Only Component (e.g. for a component showing user balance)
import { clientOnly } from "@solidjs/start/client"; const ClientComponent = clientOnly(() => import("./ClientOnlyComponent"));
-
Client-Only Page (e.g. for a
/swappage) Add the following at the top of your route file to render the entire page on the client:import { clientOnly } from "@solidjs/start/client"; export default clientOnly(async () => ({ default: MyPage }));
For more details, refer to the clientOnly documentation.
