Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rioredwards/pi-site
Self-hosted on my raspberry-pi! 🥧
https://github.com/rioredwards/pi-site
learning nextjs raspberry-pi self-hosted typescript
Last synced: about 7 hours ago
JSON representation
Self-hosted on my raspberry-pi! 🥧
- Host: GitHub
- URL: https://github.com/rioredwards/pi-site
- Owner: rioredwards
- Created: 2024-12-31T19:57:46.000Z (12 days ago)
- Default Branch: main
- Last Pushed: 2025-01-08T21:52:25.000Z (4 days ago)
- Last Synced: 2025-01-08T22:37:29.956Z (4 days ago)
- Topics: learning, nextjs, raspberry-pi, self-hosted, typescript
- Language: TypeScript
- Homepage: https://pi.rioedwards.com/
- Size: 12 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
## Real-time Updates
To enable real-time updates, you can use WebSockets. First, install the `ws` package:
```bash
npm install ws
# or
yarn add ws
# or
pnpm add ws
# or
bun add ws
```Then, set up a WebSocket server in your Next.js application. Create a new file `server.js`:
```javascript
const WebSocket = require('ws');const wss = new WebSocket.Server({ port: 8080 });
wss.on('connection', function connection(ws) {
ws.on('message', function incoming(message) {
console.log('received: %s', message);
});ws.send('something');
});
```In your client-side code, connect to the WebSocket server:
```javascript
const socket = new WebSocket('ws://localhost:8080');socket.addEventListener('message', function (event) {
console.log('Message from server ', event.data);
});
```This will allow your application to receive real-time updates from the server.