Git Product home page Git Product logo

twitter-clone's Introduction

create-svelte

Everything you need to build a Svelte project, powered by create-svelte.

Creating a project

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

# create a new project in the current directory
npm init svelte

# create a new project in my-app
npm init svelte my-app

Manage Node version with NVM

# check currently used node version
node -v

# switch to newer Node version to satisfy SvelteKit contraints
nvm use 16

Adding TailwindCSS and DaisyUI

# add TailwindCSS to a new project in the current directory
npx svelte-add@latest tailwindcss

# add env-cmd, daisyui, tailwindcss typography plugin as dev dependencies
npm i -D env-cmd daisyui @tailwindcss/typography

Adding Prisma

# initialite prima
npx prisma init --datasource-provider sqlite

To format on save using Prettier and this rule to your settings.json

# Add this json to your settings.json in VSCode
"[prisma]": {
    "editor.defaultFormatter": "Prisma.prisma"
}

# Edit your .env file
DATABASE_URL="file:./dev.db"

Create a schema for your project and install the prisma client

# Install the Prisma client which generates the client and types
npm i @prisma/client

# Create the prisma database
npx prisma db push

Please note: Use migrate dev instead of db push in real projects to create a history of your database when you make changes to the db

Seeding the database with test data

# To transpile TypeScript you ts-node and Node.js types
npm i -D ts-node @types/node

# Seeding the db
npx prisma db seed

# Seeing the data in the browser
npx prisma studio

Developing

If you prefer to use $root as an alias to access the src folder from anywhere in the project edit the svelte-config.js ...

+ import path from 'path'
...
kit: {
+	adapter: adapter(),
+   vite: {
+ 	    resolve: {
+ 		    alias: {
+ 			    $root: path.resolve('./src')
+ 		    }
+ 	    }
+   }

... and update the tsconfig.json so TypeScript knows where the files are located.

"compilerOptions": {
    ...
+   "baseUrl": ".",
+		"paths": {
+			"$root/*": ["./src/*"]
+	    }
}

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

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:

npm run build

You can preview the production build with npm run preview.

To deploy your app, you may need to install an adapter for your target environment.

Workflow

Install VSCODE Plugins

  • Conventional Commits
  • Prisma

twitter-clone's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.