Giter Site home page Giter Site logo

git-avc / doppio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nagariahussain/doppio

1.0 0.0 0.0 160 KB

A Frappe app to magically setup single page applications on your custom Frappe apps.

License: MIT License

JavaScript 31.71% Python 68.29%

doppio's Introduction

Doppio

A Frappe App to setup and manage single page applications (using Vue 3 or React) on any other custom Frappe App.

Installation

In your bench directory:

bench get-app https://github.com/NagariaHussain/doppio

This will install the Doppio frappe app on your bench and enable some custom bench CLI commands that will ease the process of attaching a SPA to your Frappe Application.

Usage

Setting up a new Single Page Application

bench add-spa --app <app-name> [--tailwindcss] [--typescript]

You will be prompted to enter a name for your single page application, this will be the name of the directory and the URI path at which the application will be served. For instance, if you enter dashboard (default), then a folder named dashboard will be created inside your app's root directory and the application will be served at /dashboard.

You will then be asked to select the framework you prefer: React or Vue.

You can also select whether you want to use Typescript or Javascript.

You can optionally pass the --tailwindcss flag which will also setup tailwindCSS (who doesn't like tailwind!) along with the Vue 3/React application.

The above command will do the following things:

For Vue 3

  1. Scaffold a new Vue 3 starter application (using Vite)

  2. Add and configure Vue router

  3. Link utility and controller files to make the connection with Frappe backend a breeze!

  4. Configure Vite's proxy options (which will be helpful in development), check the proxyOptions.js file to see to what ports the Vite dev server proxies the requests (you frappe bench server).

  5. Optionally, installs and set up tailwindCSS.

  6. Update the website_route_rules hook (in hooks.py of your app) to handle the routing of this SPA.

For React

  1. Scaffold a new React starter application (using Vite)

  2. Add and configure frappe-react-sdk to make the connection with Frappe backend a breeze!

  3. Configure Vite's proxy options (which will be helpful in development), check the proxyOptions.js file to see to what ports the Vite dev server proxies the requests (you frappe bench server).

  4. Optionally, installs and set up tailwindCSS.

  5. Update the website_route_rules hook (in hooks.py of your app) to handle the routing of this SPA.

Once the setup is complete, you can cd into the SPA directory of your app (e.g. dashboard) and run:

yarn dev

This will start a development server at port 8080 by default (any other port if this port's already in use). You can view the running application at: <site>:8080.

Building for Production

The below command builds the application and places it in the www directory of your frappe app:

cd <your-spa-name> && yarn build

Check the package.json file inside the Vue application directory to learn more about the dev server / build steps.

If you already have a package.json file with scripts in your app's root directory, you can add the following two scripts to your app's package.json file in order for the bench build command to work as expected:

"dev": "cd <your-spa-folder> && yarn dev",
"build": "cd <your-spa-folder> && yarn build"

License

MIT

doppio's People

Contributors

nagariahussain avatar nikkothari22 avatar dependabot[bot] avatar

Stargazers

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