GithubHelp home page GithubHelp logo

j-wil / pocket-nuxt Goto Github PK

View Code? Open in Web Editor NEW
75.0 3.0 14.0 47.96 MB

Single binary full stack Nuxt3 PocketBase application

License: The Unlicense

Vue 77.28% TypeScript 14.55% JavaScript 3.87% Go 4.30%

pocket-nuxt's Introduction

pocketnuxt logo

This demo allows you to login and see pocketnuxt in action. This is hosted on a small droplet in DigitalOcean using systemctl.

Pocket Nuxt

Nuxt3 and PocketBase delivered in a simple binary that can run anywhere.

This is achieved by compiling the Nuxt app into a static hosted folder and then using Go to serve the static files and pocketbase api.

//go:embed all:.output/public
var public embed.FS

Make it your own by extending Pocketbase and adding your app to the app folder.

Stack

  • PocketBase
  • Nuxt3
  • PrimeVue
  • PrimeIcons

Run Locally

This will run both a Nuxt3 dev server with hot reload and a pocketbase instance with a authentication and an api ready to go.

Clone the project

  git clone https://github.com/j-wil/pocket-nuxt

Go to the project directory

  cd pocket-nuxt

Install dependencies

  yarn install

Start the server

  yarn dev
URL Function
localhost:8090/_/ pocketbase admin setup and log
localhost:8090/api/ pocketbase api
localhost:3000/ nuxt3 dev server

From there build your nuxt app as normal. Follow the pocketbase docs for more info on how to use pocketbase.

Deployment

This will create a single binary containing Nuxt and PocketBase for deployment.

  yarn build:prod
  ./pocketnuxt serve --http "yourdomain.com:80" --https "yourdomain.com:443"

https://pocketbase.io/docs/going-to-production/ for more examples.

Acknowledgements

pocket-nuxt's People

Contributors

j-wil avatar dependabot[bot] avatar

Stargazers

noah.csol avatar Ryan Ogden avatar dgtask avatar Axel Rothe avatar Subash Babu avatar Andi avatar Manda Richard avatar Victorio Berra avatar Emigpa avatar Josh avatar  avatar Alex avatar Kobus Goosen avatar THANA avatar  avatar Alejandro Akbal avatar Fraser McTaggart avatar Andrew Shoemaker avatar Bony avatar  avatar Steve Halford avatar DIBASHI, John avatar Renzo avatar dzevs avatar anlct avatar Serhat avatar Prashanth Krishnamurthy avatar  avatar Sirvent avatar David Tai avatar  avatar Assoft avatar Matheus Gaspechak avatar Oscar Costa avatar Isaac Figueiredo  avatar nan[ф] avatar  avatar Nop avatar René avatar Muhaiminul Yeamin avatar  avatar  avatar Tim Pulver avatar Ali Bahrami Ehsan avatar IIHARA avatar gringo.dev avatar Pridsadang Pansiri avatar Ben Stroud avatar H avatar Charbs avatar Krishnamurthy G B avatar 8uff3r avatar teamhands avatar Manuel avatar Cory Brown avatar  avatar  avatar  avatar Cube_Bit avatar HenriFourie avatar Yegor Zakharov avatar Sigve Hansen avatar Saiful Azfar Ramlee avatar  avatar Mark Chenoweth avatar vadim avatar  avatar  avatar Lucas avatar Ganjar Setia M avatar Paskalouis Patressi avatar  avatar Sidney Alex avatar Muhammad Bashir Al-Noimi avatar Niko Köser avatar

Watchers

Krishnamurthy G B avatar  avatar  avatar

pocket-nuxt's Issues

pocketbase url not reactive

Hi there,

Thanks for this project :)

The url to pocketbase in https://github.com/j-wil/pocket-nuxt/blob/main/app/app.config.ts#L4 doesn't seem to be as dynamic as it should be.
When refreshing the site (F5), the pocketbase url will be http://localhost:8090/api even though the app may run under a domain (e.g. www.pocketnuxt.com).
When navigating through the SPA e.g. with navigateTo, the pocketbase url is correct (e.g. www.pocketnuxt.com/api).

Example:
Calling '/' in a fresh browser window and clicking on a button with navigateTo('/about'), where '/about' calls the pocketbase api, works.
Directly calling '/about' in a fresh window fails, because the pocketbase api requests defaults back to http://localhost:8090.

Can you reproduce this? Do you know a good fix?

Regards

Use `usePocketbase` on server API route

Thanks for the project. Very useful.

I'm new to Nuxt 3, and assessing its server api capacity.

I'm trying to consume the usePocketbase composable in a server api route.

// /server/api/auth/login.post.ts
export default defineEventHandler(async (event) => {
  const pocketbase = usePocketbase();

  ...
});

I'm basically getting a 500 usePocketbase is not defined error. How can I make it so this can be used on the server api route?

Thanks!

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.