Coder Social home page Coder Social logo

wasp-lang_replit-template's Introduction

NOTE: This is a copy of the Wasp Demo App template for Replit.com available at https://replit.com/@vincanger/wasp-template. We expect people to fork that template on Replit, not this repo here. Since our template already has Wasp installed, they don't need to do installation, instead they just get an already specific version of Wasp installed along with the Demo App (If a new version of Wasp is released, we will have to manually update that template on Replit). This repo contains all those files necessary to get that Demo App going on Replit, along with Replit and Nix config files.

Special Extra NOTE: I used a custom version of the installer (present at .config/installer.sh) that allows choosing the location of where Wasp is installed, since we need to pick a specific location for Replit to work, so that installer should also be used in the future if installing new versions of Wasp.



๐Ÿšจ IMPORTANT! You must visit your repl's url at port 9000 to correctly preview your app:
โœ… <APP_URL_WILL_GET_AUTOMATICALLY_INSERTED_HERE>

โš ๏ธ Make sure to run wasp db migrate-dev in the Shell to begin. Look to the console for tips and warnings

๐Ÿง™โ€โ™‚๏ธ Do not edit the contents of the .wasp folder (this is where Wasp magically generates your app for you)


A programming language that understands what a web app is.


Wasp (Web Application Specification Language) is a declarative DSL (domain-specific language) for developing, building and deploying modern full-stack web apps with less code.

Describe high-level features with Wasp in the main.wasp file, and they will be compiled by waspc (Wasp compiler) into a full-stack app (currently React + NodeJS/ExpressJS + Prisma).

// file: main.wasp

app WaspReplit {
  wasp: {
    version: "^0.8.0"
  },
  
  title: "WaspReplit",

  // super simple auth!
  auth: {
    userEntity: User,
    methods: {
      usernameAndPassword: {}, 
    },
    onAuthFailedRedirectTo: "/login",
  }
}

/** <---- Database Entities -----> */

// Uses Prisma Schema Language (PSL) 
// Run `wasp db migrate-dev` in the Shell after making changes

entity User {=psl 
  id          Int     @id @default(autoincrement())
  username    String  @unique
  password    String  
  tasks       Task[]
psl=}

entity Task {=psl
  id          Int     @id @default(autoincrement())
  description String
  isDone      Boolean @default(false)
  user        User?   @relation(fields: [userId], references: [id])
  userId      Int?
psl=}

/** <---- Pages & Routes -----> */

route RootRoute { path: "/", to: MainPage }
page MainPage {
  authRequired: true, // This page requires user to be authenticated.
  component: import Main from "@client/MainPage.jsx"
}

route LoginRoute { path: "/login", to: LoginPage }
page LoginPage {
  component: import Login from "@client/LoginPage.jsx"
}

route SignupRoute { path: "/signup", to: SignupPage }
page SignupPage {
  component: import Signup from "@client/SignupPage.jsx"
}

/** <---- Operations -----> */

query getTasks {
  fn: import { getTasks } from "@server/queries.js",
  entities: [Task]
}

action createTask {
  fn: import { createTask } from "@server/actions.js",
  entities: [Task]
}

action updateTask {
  fn: import { updateTask } from "@server/actions.js",
  entities: [Task]
}

Source files (.wasp, .js(x), .css, ...) are compiled by waspc (Wasp compiler) into a truly full-stack web app! (currently React + NodeJS/ExpressJS + Prisma).

wasp-lang_replit-template's People

Contributors

vincanger avatar

Stargazers

 avatar

Watchers

 avatar  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.