# Project export: Slug Mommy

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: CruzHacks 2024
- Tagline: A UCSC assistant designed to optimize student daily schedules, reminders for tasks, & mental health
- Devpost: https://devpost.com/software/slug-mommy
- GitHub: https://github.com/Sluggish-Solutions/Slug-Mommy
- Result: winner (Best UI/UX Hack)
- Team: 4 GitHub contributor(s) — suri312006 (46 commits), Alb111 (44 commits), ryunzz (11 commits), kenricqq (1 commits)

## Devpost submission (written by the team)

### Inspiration

Slug Mommy was inspired by the realization that the transition from high school to college may not be as smooth as everyone may think. With Slug Mommy, college students will be able to transition into more disciplined people who stay consistent with their positive habits.

### What it does

Slug Mommy is a web application in which users can create an account for a personalized assistant to organize the tasks they schedule themselves. Slug Mommy promotes user discipline to keep up with their daily habits/goals.

### How we built it

We utilized SvelteKit and TypeScript to create a full-stack web application. We used Open-AI's API to help create our real-time user interaction with our application's chatbot!

### Challenges we ran into

Some challenges we ran into were figuring out the tokenization for Open-AI's API to manage message requests and chat history.

### What's next

In the future, we will be bringing a calendar implementation to Slug Mommy to create a more interactive and user-friendly application. We also plan to create a more visual

## README (from the GitHub repository)

# create-svelte

Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!

```bash
# create a new project in the current directory
npm create svelte@latest

# create a new project in my-app
npm create svelte@latest my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

To create a production version of your app:

```bash
npm run build
```

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.


## Detected evidence (automated analysis)

Indexed codebase: 40 recognized source files, 58 KB.
- HTML (language) — detected in the code
- JavaScript (language) — detected in the code
- OpenAI (technology) — detected in the code
- Supabase (technology) — detected in the code
- Svelte (technology) — detected in the code
- Tailwind CSS (technology) — detected in the code
- TypeScript (language) — detected in the code
- Vercel AI SDK (technology) — detected in the code
- Node.js (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (49 of 49)

```
.gitignore
.npmrc
.vscode/settings.json
bun.lockb
openai-test.js
package.json
postcss.config.cjs
README.md
src/app.d.ts
src/app.html
src/app.postcss
src/hooks.server.ts
src/lib/components/chat/MommyMessage.svelte
src/lib/components/chat/UserMessage.svelte
src/lib/components/home/Dropdown.svelte
src/lib/components/home/Header.svelte
src/lib/components/Radial.svelte
src/lib/components/SlugMommy.svelte
src/lib/components/Task.svelte
src/lib/components/TaskList.svelte
src/lib/components/TaskTableRow.svelte
src/lib/components/Type.svelte
src/lib/components/Typewriter.svelte
src/lib/index.ts
src/lib/tokenizer.ts
src/mycustom-theme.ts
src/routes/+layout.server.ts
src/routes/+layout.svelte
src/routes/+layout.ts
src/routes/+page.server.ts
src/routes/+page.svelte
src/routes/api/send_message/+server.ts
src/routes/service-worker.ts
src/routes/settings/+page.svelte
src/routes/signup/+page.server.ts
src/routes/signup/+page.svelte
src/routes/talk/+layout.ts
src/routes/talk/+page.svelte
src/routes/talk/+page.ts
src/routes/welcome/+page.svelte
src/stores/taskStore.ts
src/stores/userStore.ts
static/manifest.json
svelte.config.js
tailwind.config.ts
tsconfig.json
types/command.md
types/supabase.types.ts
vite.config.ts
```

### Dependencies

- package.json: @fortawesome/fontawesome-free@^6.5.1, @skeletonlabs/skeleton@2.7.1, @skeletonlabs/tw-plugin@0.3.1, @supabase/auth-helpers-sveltekit@^0.11.0, @supabase/supabase-js@^2.39.3, @sveltejs/adapter-auto@^3.0.0, @sveltejs/adapter-vercel@^5.1.0, @sveltejs/kit@^2.0.0, @sveltejs/vite-plugin-svelte@^3.0.0, @tailwindcss/forms@0.5.7, @types/node@20.11.5, ai@^2.2.31, autoprefixer@10.4.17, gpt3-tokenizer@^1.1.5, lucide-svelte@^0.312.0, moment@^2.30.1, openai@^4.24.7, postcss@8.4.33, svelte@^4.2.7, svelte-check@^3.6.0, tailwindcss@3.4.1, tslib@^2.4.1, typescript@^5.0.0, vite@^5.0.3, vite-plugin-tailwind-purgecss@0.2.0

### Recent commits (newest first)

- hello
- not sure
- asdf
- Merge pull request #2 from Sluggish-Solutions/localStore
- asdf
- asdf
- asdf
- asdf
- asdf
- Merge pull request #1 from Sluggish-Solutions/localStore
- should be fixed
- idk
- asdf
- asdf
- slug mommy changing wahooo!!
- asdf
- Merge branch 'localStore' of https://github.com/Sluggish-Solutions/Slug-Mommy into localStore
- data
- asdf
- Merge branch 'main' of https://github.com/Sluggish-Solutions/Slug-Mommy

## Key source files (fetched from GitHub, selected and truncated for size)

### types/command.md

```markdown

npx supabase gen types typescript --project-id "ejyqaykdahanolzkmvzu" --schema public > types/supabase.types.ts

```

### package.json

```
{
  "name": "slug-mommy",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "dev": "vite dev",
    "build": "vite build",
    "preview": "vite preview",
    "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
    "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
  },
  "devDependencies": {
    "@skeletonlabs/skeleton": "2.7.1",
    "@skeletonlabs/tw-plugin": "0.3.1",
    "@sveltejs/adapter-auto": "^3.0.0",
    "@sveltejs/kit": "^2.0.0",
    "@sveltejs/vite-plugin-svelte": "^3.0.0",
    "@tailwindcss/forms": "0.5.7",
    "@types/node": "20.11.5",
    "autoprefixer": "10.4.17",
    "postcss": "8.4.33",
    "svelte": "^4.2.7",
    "svelte-check": "^3.6.0",
    "tailwindcss": "3.4.1",
    "tslib": "^2.4.1",
    "typescript": "^5.0.0",
    "vite": "^5.0.3",
    "vite-plugin-tailwind-purgecss": "0.2.0"
  },
  "type": "module",
  "dependencies": {
    "@fortawesome/fontawesome-free": "^6.5.1",
    "@supabase/auth-helpers-sveltekit": "^0.11.0",
    "@supabase/supabase-js": "^2.39.3",
    "@sveltejs/adapter-vercel": "^5.1.0",
    "ai": "^2.2.31",
    "gpt3-tokenizer": "^1.1.5",
    "lucide-svelte": "^0.312.0",
    "moment": "^2.30.1",
    "openai": "^4.24.7"
  }
}

```

### src/lib/index.ts

```typescript
// place files you want to import through the `$lib` alias in this folder.

```

### vite.config.ts

```typescript
import { purgeCss } from 'vite-plugin-tailwind-purgecss';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';

export default defineConfig({
	plugins: [sveltekit(), purgeCss()]
});
```

### openai-test.js

```javascript
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const completion = await openai.chat.completions.create({
    messages: [{ role: "system", content: "You are a helpful assistant." }],
    model: "gpt-3.5-turbo",
  });

  console.log(completion.choices[0]);
}

main();
```

### tailwind.config.ts

```typescript
import { join } from 'path'
import type { Config } from 'tailwindcss'
import forms from '@tailwindcss/forms';
import { skeleton } from '@skeletonlabs/tw-plugin'
import { myCustomTheme } from './src/mycustom-theme'

export default {
	darkMode: 'class',
	content: ['./src/**/*.{html,js,svelte,ts}', join(require.resolve('@skeletonlabs/skeleton'), '../**/*.{html,js,svelte,ts}')],
	theme: {
		extend: {},
	},
	plugins: [
		forms,
		skeleton({
			themes: {
				custom: [
					myCustomTheme
				],
			},
		}),
	],
} satisfies Config;

```

### svelte.config.js

```javascript
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
const config = {
	extensions: ['.svelte'],
	// Consult https://kit.svelte.dev/docs/integrations#preprocessors
	// for more information about preprocessors
	preprocess: [vitePreprocess()],
	
	kit: {
		// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
		// If your environment is not supported or you settled on a specific environment, switch out the adapter.
		// See https://kit.svelte.dev/docs/adapters for more information about adapters.
		adapter: adapter(),
		alias: {
			$lib: './src/lib',
			$components: './src/lib/components',
			$stores: './src/stores',
		}
	}
};
export default config;
```

### src/app.html

```html
<!DOCTYPE html>
<html lang="en" class="dark">
	<head>
		<meta charset="utf-8" />
		<link rel="icon" href="%sveltekit.assets%/favicon.png" />
		<link rel="manifest" href="%sveltekit.assets%/manifest.json">
		<meta name="viewport" content="width=device-width" />
		%sveltekit.head%
	</head>
	<body data-sveltekit-preload-data="hover" data-theme="my-custom-theme">
		<div style="display: contents">%sveltekit.body%</div>
	</body>
</html>

```

### src/app.d.ts

```typescript

// src/app.d.ts

import { SupabaseClient, Session } from '@supabase/supabase-js';

declare global {
	namespace App {
		interface Locals {
			supabase: SupabaseClient;
			getSession(): Promise<Session | null>;
		}
		interface PageData {
			session: Session | null;
		}
		// interface Error {}
		// interface Platform {}
	}
}

declare type Comment = {
	id: string;
	body: string;
	author: string;
	parent_post: string;
	created_at: string;
};

```

### src/hooks.server.ts

```typescript
import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY} from '$env/static/public'
import { createSupabaseServerClient} from '@supabase/auth-helpers-sveltekit'
import type { Handle } from '@sveltejs/kit'
import type { Database} from '../types/supabase.types'

export const handle: Handle = async ({event, resolve}) => {
	event.locals.supabase = createSupabaseServerClient<Database>({
		supabaseUrl: PUBLIC_SUPABASE_URL,
		supabaseKey: PUBLIC_SUPABASE_ANON_KEY,
		event
	})

	event.locals.getSession = async () => {
		const {
			data: {session},
			
		} = await event.locals.supabase.auth.getSession()
		return session
	}

	return resolve( event, {
		filterSerializedResponseHeaders(name) {
			return name === 'content-range'
		}
	})
}


```

[29 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]