**Motivations:** - total_sponsoring should be calculated from cache, not stored in tags - Author searches should use cache first, not query Nostr directly - All elements should be read/written from/to database - Background sync should scan all notes with service='zapwall.fr' tag and update cache - Sync should run at startup and resume on each page navigation **Root causes:** - total_sponsoring was stored in tags which required updates on every sponsoring payment - Author queries were querying Nostr directly instead of using cache - No background sync service to keep cache up to date with new notes **Correctifs:** - Removed totalSponsoring from AuthorTags interface and buildAuthorTags - Modified getAuthorSponsoring to calculate from cache (sponsoring queries) instead of tags - Modified parsePresentationEvent to set totalSponsoring to 0 (calculated on demand from cache) - Modified fetchAuthorByHashId and fetchAuthorPresentationFromPool to use cache first and calculate totalSponsoring from cache - Created platformSyncService that scans all notes with service='zapwall.fr' tag and caches them - Modified _app.tsx to start continuous sync on mount and resume on page navigation - All author presentations now calculate totalSponsoring from cache when loaded **Evolutions:** - Cache-first architecture: all queries check cache before querying Nostr - Background sync service keeps cache up to date automatically - totalSponsoring is always calculated from actual sponsoring data in cache - Better performance: cache queries are faster than Nostr queries - Non-blocking sync: background sync doesn't block UI **Pages affectées:** - lib/nostrTagSystemTypes.ts - lib/nostrTagSystemBuild.ts - lib/articlePublisherHelpersPresentation.ts - lib/sponsoring.ts - lib/authorQueries.ts - lib/platformSync.ts (new) - pages/_app.tsx
zapwall4Science
Plateforme de publication d'articles scientifiques et de science-fiction avec système de sponsoring, commissions et rémunération des avis. Les lecteurs peuvent lire les aperçus gratuitement et débloquer le contenu complet en payant avec Lightning Network.
Repository: https://git.4nkweb.com/4nk/story-research-zapwall
Table of Contents
- Features
- Getting Started
- Configuration
- Lightning Wallet Setup
- Project Structure
- Contributing
- Documentation
- License
Features
- Nostr Authentication: Authenticate using Alby browser extension (NIP-07)
- Free Previews: Public notes showing article previews
- Paid Content: Private notes containing full content, unlocked after 800 sats zap
- Lightning Payments: Integrated Alby/WebLN for Lightning payments (works with Alby and other Lightning wallets)
- Payment Modal: User-friendly payment interface with invoice display
- TypeScript: Fully typed codebase
Getting Started
- Install dependencies:
npm install
- Run the development server:
npm run dev
- Open http://localhost:3000 in your browser
Configuration
The application stores all configuration in IndexedDB (browser storage) with hardcoded defaults. No environment variables are required.
Default Configuration
- Nostr Relay:
wss://relay.damus.io(default) - NIP-95 Upload API:
https://nostr.build/api/v2/upload(default) - Platform Lightning Address: Empty by default
Customizing Configuration
Configuration is stored in IndexedDB and can be customized through the application settings. The application supports:
- Multiple Nostr relays (with priority ordering)
- Multiple NIP-95 upload APIs (with priority ordering)
- Platform Lightning address for commissions
All configuration values are stored locally in the browser and persist across sessions. Default values are hardcoded in the application code.
Lightning Wallet Setup
This project uses Alby browser extension for both Nostr authentication and Lightning payments:
- Alby: Install the Alby browser extension
- Alby provides both Nostr authentication (NIP-07) and Lightning payments (WebLN)
Users need to have Alby installed to authenticate and make payments. The application will prompt them to connect when needed.
Project Structure
/pages: Next.js pages/components: React components/lib: Utilities and Nostr helpers/types: TypeScript type definitions/hooks: Custom React hooks
Déploiement
Documentation complète
La documentation complète du déploiement est disponible dans le dossier docs/ :
- Documentation complète du déploiement : Guide détaillé de déploiement, configuration et maintenance
- Référence des scripts : Description de tous les scripts disponibles
- Guide de référence rapide : Commandes essentielles
Déploiement rapide
Le site est déployé sur zapwall.fr (serveur : 92.243.27.35).
Mise à jour du site :
# Méthode recommandée : Script automatique
./update-remote-git.sh
Vérification du statut :
ssh debian@92.243.27.35 'sudo systemctl status zapwall'
Informations de déploiement
- Répertoire :
/var/www/zapwall.fr - Port application :
3001 - Service systemd :
zapwall.service - Nginx : Conteneur Docker
lecoffre_nginx_test - HTTPS : Configuré avec redirection automatique HTTP → HTTPS
Pour plus de détails, consultez la documentation complète.
Contributing
We welcome contributions! Please read our Contributing Guide to get started.
How to Contribute
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes following our coding guidelines
- Run lint and type-check (
npm run lint && npm run type-check) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure your code follows our strict quality standards:
- No fallbacks or silent failures
- Full TypeScript typing (no
any, nots-ignore) - Proper error handling and logging
- Accessibility compliance (ARIA, keyboard navigation, contrast)
See CONTRIBUTING.md for detailed guidelines.
Documentation
- User Guide: Complete user documentation
- Technical Documentation: Architecture and technical details
- Deployment Guide: Deployment and configuration
- FAQ: Frequently asked questions
- Publishing Guide: How to publish articles
- Payment Guide: Lightning payment setup
License
This project is licensed under the MIT License - see the LICENSE file for details.