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

Overview

Doppio

A Frappe App to setup and manage single page applications (using Vue 3) 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]

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 can optionally pass the --tailwindcss flag which will also setup tailwindCSS (who doesn't like tailwind!) along with the Vue 3 application.

The above command will do the follwing things:

  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's up tailwindCSS.

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

Do whatever you want with the code. If you can sell it, go ahead an make some money!

Comments
  • bash: app-name: No such file or directory

    bash: app-name: No such file or directory

    When i try to create an app using add-spa command: bench add-spa --app <app-name> [--tailwindcss]

    it is throwing the below error: bash: app-name: No such file or directory

    When I check bench commands by running: bench --help

    it did show the that add-spa command under framework commands list:

    Framework commands: add-spa add-system-manager Add a new system manager to a site add-to-email-queue Add an email to the Email Queue add-to-hosts Add site to hosts backup Backup

    opened by saru2020 10
  • Support for React

    Support for React

    Hey @NagariaHussain ,

    I am planning to create a similar Frappe app to setup a React SPA with Frappe. Should I contribute to this repository or would you recommend creating a new project (Frappe app) for React?

    opened by nikkothari22 6
  • useEffect Hook not working

    useEffect Hook not working

    I have created a doppio react app for a shopping cart that is support to list items on the /shop page.

    I tried loading the items using a React useEffect hook, it didn't work.

    Ps: Nothing works on the useEffect Hook: alert, console.log etc.

    @NagariaHussain @nikkothari22

    opened by saleemdev 5
  • Installing gave invalid syntax

    Installing gave invalid syntax

    Traceback (most recent call last): File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 68, in get_app_commands app_command_module = importlib.import_module(app + '.commands') File "/home/frappe/frappe-bench/env/lib/python3.5/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 986, in _gcd_import File "", line 969, in _find_and_load File "", line 958, in _find_and_load_unlocked File "", line 673, in _load_unlocked File "", line 665, in exec_module File "", line 222, in _call_with_frames_removed File "/home/frappe/frappe-bench/apps/doppio/doppio/commands/init.py", line 2, in from .spa_generator import SPAGenerator File "/home/frappe/frappe-bench/apps/doppio/doppio/commands/spa_generator.py", line 17 self.spa_path: Path = self.app_path / self.spa_name ^ SyntaxError: invalid syntax

    opened by Helkyd 3
  • CSRF Token Error during local development in React app with Vite + Frappe

    CSRF Token Error during local development in React app with Vite + Frappe

    Hi Hussain,

    I know my issue isn't directly related to this project, but I tried setting up a SPA with React + Vite - by looking at your Vue + Vite example. Thank you!

    I am able to run the React app, both on production (after bench update --build) as well as in live reload (yarn dev). However, my API calls to the backend encounter the CSRF Token Error while live reloading. The API calls work after building the application and serving it using bench start. I assume this is because the build files are generated when I run bench update --build and the Python context adds the CSRF token.

    How do I make this work in live reload since that's critical to a great developer experience?

    Thank you!

    opened by nikkothari22 2
  • React build doesnt render page on /<path/to/spa>

    React build doesnt render page on /

    I've created a SPA and it runs on the dev environment, but doesn't render anything on the browser /path when I yarn build

    I don't know what I might have missed.

    opened by saleemdev 1
  • feat: add support for react

    feat: add support for react

    I have added support for React in the Doppio CLI.

    Major changes and tasks:

    • [x] Add option to select framework while setting up SPA
    • [x] Split logic for Vue and React. Some file changes (e.g. proxy options, CSRF) were common.
    • [x] Add frappe-react-sdk for React apps in package.json. This will provide hooks for auth. database, search, file management, API calls and realtime listeners using Socket.io. Also ensure to initialise the library in App.jsx.
    • [x] Update documentation

    I have also added a prompt for the app name - in case users do not specify it in the initial command.

    Closes #7

    opened by nikkothari22 1
  • add-spa is not a command

    add-spa is not a command

    next i installed it in my frappe bench site, i run de command bench add-spa --app , but console show that add-spa is not a command, but when i run bench --help, add-spa is show in commands list.

    run in a docker container running debian:buster-slim as image

    opened by Desstter 1
  • chore(deps-dev): bump vite from 2.6.14 to 2.9.13

    chore(deps-dev): bump vite from 2.6.14 to 2.9.13

    Bumps vite from 2.6.14 to 2.9.13.

    Release notes

    Sourced from vite's releases.

    [email protected]

    Please refer to CHANGELOG.md for details.

    [email protected]

    Please refer to CHANGELOG.md for details.

    [email protected]

    Please refer to CHANGELOG.md for details.

    Changelog

    Sourced from vite's changelog.

    2.9.13 (2022-06-27)

    2.9.12 (2022-06-10)

    • fix: backport outdated optimized dep removed from module graph (#8534) (c0d6c60), closes #8534

    2.9.11 (2022-06-10)

    2.9.10 (2022-06-06)

    2.9.9 (2022-05-11)

    2.9.8 (2022-05-04)

    ... (truncated)

    Commits
    Maintainer changes

    This version was pushed to npm by vitebot, a new releaser for vite since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • bug:

    bug: "module" in package.json causes error in importing proxyOptions

    The default Vite configuration adds "type": "module" to package.json. Refer here

    This causes an error while starting the live server because proxyOptions is exported

    image

    One possible solution is to remove "type": "module" from package.json. Or we could export proxyOptions in a cjs file or as a standard export.

    bug 
    opened by nikkothari22 0
  • Challenge with Routing in ReactJS SPA

    Challenge with Routing in ReactJS SPA

    Hello, I have created a React SPA within an app, and the website_route_rules are automatically set up in hooks as follows.:

    -Frappe app name: haulster -SPA name : frontend

    -website_route_rules = [{'from_route': '/frontend/<path:app_path>', 'to_route': 'frontend'}]

    -react-router-dom routes:

              <Routes>
                <Route path="/" exact element ={<Trip/>}/>
                <Route path="/fuel" exact element ={<FuelRequest/>}/>
                <Route path="/maintenance" exact element ={<MaintenanceRequest/>}/>
              </Routes>
            </Router>```
    
    -Problem: None of those routes are being rendered on production that is returning a blank page. Yet in developer mode (```localhost```)  the pages are being rendered.
    
    
    ![prod_environment](https://user-images.githubusercontent.com/12731579/209992337-9d12d0a4-1d16-4352-ad62-8b6e08aa5119.png)
    ![dev_environment](https://user-images.githubusercontent.com/12731579/209992354-0fbeb277-dedd-46fb-8ab6-0decc1077164.png)
    
    
    
    
    
    
    opened by saleemdev 8
  • Add support for Typescript

    Add support for Typescript

    We can add an option to use the Typescript starter templates for Vue or React (vue-ts/react-ts). We would have to make some changes to boilerplates and file names for this.

    • [ ] Add flag for Typescript in CLI options
    • [ ] Initialise Vite with vue-ts and react-ts templates if TS selected.
    • [ ] For Vue - main.js will be main.ts in link_controller_files. (If TS selected)
    • [ ] For React - App.jsx will be App.tsx in create_react_files. (If TS selected)
    • [ ] vite.config.js will be vite.config.ts
    • [ ] Update documentation
    enhancement 
    opened by nikkothari22 0
Releases(v0.2)
  • v0.2(Sep 14, 2022)

  • v0.1(Sep 30, 2021)

    First Release 🎉🎉🎉

    • The frontend that powers Frappe Cloud!
    • Helps you create awesome user experiences backed by Frappe Framework, Vue 3 and TailwindCSS
    • Includes resource manager to easily call backend APIs and manage state (loading, error, etc.)
    • Makes setting up a Single Page application (Vue 3 / Vite) a breeze
    • Supports setting up tailwindCSS (with just one flag!)

    #DFTBA

    Source code(tar.gz)
    Source code(zip)
Owner
Mohammad Hussain Nagaria
Software Engineer & Coding Instructor
Mohammad Hussain Nagaria
A single-page web-app made to browse and download your Netlify deploys. Built with Vue.js and Vite, deployed on Netlify.

A single-page web-app made to browse and download your Netlify deploys. Built with Vue.js and Vite, deployed on Netlify.

Hrishikesh Kokate 0 Aug 30, 2022
A simple single page application for managing your personal life

LifeDash A simple single page application for managing your personal life. In early-stage development. See the application live on Ldash.me. Want to s

@stux 9 Oct 16, 2022
Chatty social network from Codecourse tutorial rebuilt from scratch as a single-page app.

Chattier Social Network Chatty social network from Codecourse tutorial rebuilt from scratch as a single-page app. Laravel 5.6 JWT-based authentication

Ranie Santos 37 Jan 27, 2021
Vue single page app to generate Terraform code for Mongey's Kafka provider

Vue single page app to generate Terraform code for Mongey's Kafka provider

null 2 Jan 19, 2022
FOSS Digital Asset Distribution Platform built on Frappe.

Digistore FOSS Digital Assets Marketplace. Distribute digital assets, like a pro. Video Demo Here Features Create, attach and list digital assets (PDF

Mohammad Hussain Nagaria 30 Dec 8, 2022
Frappe-ui - A set of components and utilities for rapid UI development

Frappe UI A set of components and utilities for rapid UI development. Frappe UI

Frappe 88 Dec 30, 2022
A small plugin for Frappe that adds the support of customizations to the attach control.

Frappe Better Attach Control A small plugin for Frappe that adds the support of customizations to the attach control. Table of Contents Requirements S

Ameen Ahmed 17 Dec 25, 2022
Flutter ARB is a web editor for creating and editing your .arb files needed for internationalising your Flutter applications.

Flutter ARB Editor Description This is a web editor for .arb files, which are required for internationalizing flutter applications using the official

null 9 Dec 14, 2022
A Vue.js single page application for basic Management By Objective tasks using ASP .NET Webapi 2 and SQL server

SPA-asp.net-api-vuejs- Single Page Application using ASP .NET and vuejs. NOTE If you are looking for best practices for developing Vue.js application,

Muhammad Ubaid Raza 60 Nov 21, 2022
Single page web application using golang/vue.js/postgressql

Step 1(Initialize PostgreSQL database using Python Script) NOTE:The CSV file name should not contain spaces else their will be errors while creating t

null 1 Feb 5, 2022
🎂 Birthday Webpage - This is a birthday SPA (Single-Page-Application) using Vue.js.

A birthday SPA (Single-Page-Application) using Vue.jsA birthday SPA (Single-Page-Application) using Vue.js

Philip Bagus Kristianto 0 Feb 12, 2022
Fan-made SPA (Single Page Application) website for Evelyn. Created with Vue.js + TypeScript + SASS.

Fan-made SPA (Single Page Application) website for Evelyn. Created with Vue.js + TypeScript + SASS.

Gifaldy Azka 8 Aug 10, 2022
A Single-Page Application CRUD (create, read, update, delete) project built on vuejs, vuetify frontend components, and json-server api mock

todovue Versão 3 do aplicativo todovue, feito inteiramente em componentes Vuejs Essa aplicação está sendo criada com base no desafio proposto em sala

Marcelo Silva 2 Oct 11, 2022
Embed custom tools on your website with your Supabase instance

Supaembed Embed custom tools on your website with your Supabase instance. Free • Open Source View Demo · Report Bug · Request Feature ?? Features ?? F

zernonia 20 Dec 23, 2022
Register page, Login page and Contact list with Vue.js and Firebase

Register, Login and Contact list This is a personal study project. Only for study and reference. View project About Contact Joao Paulo C. M. Fricks jp

João Paulo Fricks 0 Sep 29, 2022
Create a pokedex web page containing pokemon listing, details and favorite pokemon page

pokedex-vue-assessment Project setup npm install Compiles and hot-reloads for development npm run serve Compiles and minifies for production npm run

Saiful Afiq 0 Jan 6, 2022
🏩 A simple process manager for developers. Start apps from your browser and access them using local domains

hotel Start apps from your browser and use local domains/https automatically Tip: if you don't enable local domains, hotel can still be used as a cata

null 9.9k Jan 2, 2023
Jetstreams Inertia vue 3 setup... but with typescript

Jetstreams Inertia vue 3 setup... but with typescript It took me hours to actually get this working... So to save my self future efforts and potential

Sam Parton 39 Nov 20, 2022
Basic vuejs project boiler-plate setup with tailwindcss, vuex, vue-router, vue-i18n...

Basic vuejs project boiler-plate setup with tailwindcss, vuex, vue-router, vue-i18n...

fotiecodes 2 Nov 3, 2022