Below you'll find all the necessary information to get started with the project, including setup instructions and common commands.
To get the project up and running on your local machine, follow these steps:
git clone https://github.com/Robodealz/webapp.git
cd webapp
Using Bun as the package manager:
bun install
Set type of db in prisma/schema.prisma
file:
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
Create a .env
file in the root directory and populate it with the necessary environment variables:
DATABASE_URL="mysql://user:password@hostnameOrIp:port/dbname"
bun prisma generate
bun prisma migrate dev
bun dev
Building it:
bun run build
bun preview # To preview the production build
And running the production build with bun:
cd build
bun run start
bun prisma studio
bun prisma migrate dev --name add_new_feature
shadcn-svelte is a anti-component component library for Svelte. Anti component means it's components source code is installed to your src/lib/components/ui
directory by using it's CLI.
bunx shadcn-svelte@latest add button
Takes component names as space separated input to directly install them.
Without any component name behind the command, an installer is started where components can be selected.
Inside your Svelte component:
<script lang="ts">
import { Button } from '$lib/components/ui/button';
</script>
<button>Button</button>
bunx shadcn-svelte@latest update button
To run tests using Playwright and Vitest:
bun vitest
bun playwright test
To ensure your code adheres to the set standards using ESLint and Prettier:
bun lint
bun prettier --write .
https://bun.sh/docs/api/websockets
// hooks.server.js
/** @type {import("svelte-adapter-bun").WebSocketHandler} */
export const handleWebsocket = {
open(ws) {
console.log('WebSocket opened');
ws.send('Finally');
},
/**
* @param {Request} request
* @param {Function} upgrade
*/
upgrade(request, upgrade) {
const url = new URL(request.url);
if (url.pathname.startsWith('/ws')) {
return upgrade(request);
}
},
};