{"id":29565670,"url":"https://github.com/michaelwp/postedin","last_synced_at":"2025-12-31T14:31:16.703Z","repository":{"id":304766467,"uuid":"1019528341","full_name":"michaelwp/PostedIn","owner":"michaelwp","description":"an application to create a auto linkedin post schedule","archived":false,"fork":false,"pushed_at":"2025-07-15T05:36:04.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-15T08:35:16.851Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelwp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-14T13:16:56.000Z","updated_at":"2025-07-15T05:29:35.000Z","dependencies_parsed_at":"2025-07-15T08:47:34.294Z","dependency_job_id":null,"html_url":"https://github.com/michaelwp/PostedIn","commit_stats":null,"previous_names":["michaelwp/postedin"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/michaelwp/PostedIn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2FPostedIn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2FPostedIn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2FPostedIn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2FPostedIn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelwp","download_url":"https://codeload.github.com/michaelwp/PostedIn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2FPostedIn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265837750,"owners_count":23836558,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-18T21:35:07.862Z","updated_at":"2025-12-31T14:31:16.697Z","avatar_url":"https://github.com/michaelwp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PostedIn - LinkedIn Post Scheduler\n\nA full-stack application for scheduling LinkedIn posts with Go backend and React web client, featuring automatic publishing and timezone-aware scheduling.\n\n## Features\n\n### Core Features\n- **Smart Scheduling** - Schedule posts with specific dates and times in your timezone\n- **Automatic Publishing** - Timer-based automatic posting at exact scheduled times\n- **Multiple Post Management** - Delete single or multiple posts at once\n- **Timezone Support** - Configure your local timezone for accurate scheduling\n- **LinkedIn API Integration** - Automatically publish to LinkedIn\n- **OAuth2 Authentication** - Secure LinkedIn login\n- **Auto-publish** - Bulk publish all due posts\n- **Real-time Status** - Live status display with countdown timers\n- **Persistent JSON storage** - Reliable data storage\n\n### Web Interface\n- **React Web Client** - Modern web interface built with React and TypeScript\n- **RESTful API** - Comprehensive REST API with OpenAPI/Swagger documentation\n- **Real-time Dashboard** - Web-based dashboard for managing posts\n- **Responsive Design** - Works on desktop and mobile devices\n\n### Architecture\n- **Clean modular architecture** - Well-organized codebase\n- **API Versioning** - Versioned REST API (`/api/v1/`) for backward compatibility\n- **Static File Serving** - Integrated web client serving\n\n## Project Structure\n\n```\nPostedIn/\n├── bin/                    # Binary files and web client (gitignored)\n│   └── web/\n│       └── dist/          # Built web client files\n├── cmd/\n│   ├── scheduler/          # CLI application entry point\n│   │   └── main.go\n│   └── web-api/           # Web API server entry point\n│       └── main.go\n├── internal/\n│   ├── models/            # Data models (Post with CronEntryID)\n│   │   └── post.go\n│   ├── scheduler/         # Core scheduling logic\n│   │   └── scheduler.go\n│   ├── cli/              # Command-line interface (11 menu options)\n│   │   └── cli.go\n│   ├── cron/             # Automatic scheduling system (timer-based)\n│   │   └── cron.go\n│   ├── config/           # Configuration and timezone management\n│   │   └── config.go\n│   ├── timezone/         # Timezone handling utilities\n│   │   └── timezone.go\n│   ├── auth/             # LinkedIn OAuth authentication\n│   │   └── auth.go\n│   ├── debug/            # Authentication debugging utilities\n│   │   └── auth.go\n│   └── api/              # RESTful API server (versioned)\n│       ├── router.go     # API routing and middleware\n│       ├── posts.go      # Post management endpoints\n│       ├── auth.go       # Authentication endpoints\n│       ├── scheduler.go  # Scheduler control endpoints\n│       └── timezone.go   # Timezone configuration endpoints\n├── web-client/            # React/TypeScript web client\n│   ├── src/\n│   │   ├── components/   # React components\n│   │   ├── services/     # API client\n│   │   ├── store/        # State management (Zustand)\n│   │   └── models/       # TypeScript types\n│   ├── dist/            # Built web client (copied to bin/web/dist)\n│   ├── package.json\n│   └── vite.config.ts\n├── pkg/\n│   ├── storage/          # JSON storage implementation\n│   │   └── json.go\n│   └── linkedin/         # LinkedIn API client\n│       └── client.go\n├── docs/                 # Swagger/OpenAPI documentation\n├── go.mod\n├── config.json          # Configuration file (auto-created)\n├── posts.json           # Data storage (auto-created)\n└── linkedin_token.json  # OAuth token storage (auto-created)\n```\n\n## Building and Running\n\n### Using Makefile (Recommended):\n```bash\nmake help              # Show all available targets\nmake build             # Build the CLI application\nmake build-web-api     # Build the web API server\nmake build-web-client  # Build the React web client\nmake build-all         # Build all applications and web client\nmake run               # Run the CLI application directly\nmake run-web-api       # Run the web API server directly\nmake start-daemon      # Start scheduler daemon with auto-publishing\nmake clean             # Clean all build artifacts\n```\n\n### Manual Commands:\n```bash\n# Run CLI application directly\ngo run cmd/scheduler/main.go\n\n# Run web API server directly\ngo run cmd/web-api/main.go\n\n# Build CLI binary\ngo build -o bin/linkedin-scheduler cmd/scheduler/main.go\n./bin/linkedin-scheduler\n\n# Build web API server binary\ngo build -o bin/web-api-server cmd/web-api/main.go\n./bin/web-api-server\n\n# Build web client\ncd web-client \u0026\u0026 npm ci \u0026\u0026 npm run build\n```\n\n### Development:\n```bash\nmake dev       # Format, vet, lint, and build\nmake fmt       # Format code\nmake vet       # Run go vet\nmake lint      # Run golangci-lint\nmake test      # Run tests\nmake tidy      # Tidy modules\nmake pre-commit # Run pre-commit checks manually\n```\n\n## LinkedIn API Setup\n\nTo use LinkedIn posting features, you need to set up a LinkedIn app:\n\n1. See [LINKEDIN_SETUP.md](LINKEDIN_SETUP.md) for detailed setup instructions\n2. Run the app and it will create a `config.json` template\n3. Fill in your LinkedIn app credentials\n4. Use option 5 to authenticate with LinkedIn\n5. Start posting!\n\n## Quick Start\n\n### CLI Application\n1. **Build and run**: `make run` or `go run cmd/scheduler/main.go`\n2. **Configure timezone**: Choose option 9 to set your local timezone\n3. **Setup LinkedIn**: See [LINKEDIN_SETUP.md](LINKEDIN_SETUP.md) and use option 5 to authenticate\n4. **Schedule posts**: Use option 1 to schedule posts\n5. **Watch them publish automatically**: The app will publish at exact scheduled times\n\n### Web Application\n1. **Build everything**: `make build-all`\n2. **Start web server**: `make run-web-api` or `go run cmd/web-api/main.go`\n3. **Open in browser**: Navigate to [http://localhost:8080](http://localhost:8080)\n4. **Configure and authenticate**: Use the web interface to set up LinkedIn integration\n5. **Manage posts**: Schedule, edit, and manage posts through the web dashboard\n\n## Usage\n\nThe application provides an interactive menu with the following options:\n\n1. **Schedule a new post** - Enter content and target date/time in your timezone\n2. **List scheduled posts** - View all posts with their status and countdown timers\n3. **Check due posts** - Review posts ready for publishing\n4. **Delete posts** - Remove single or multiple posts (supports: `5` or `1,3,5` or `1 3 5`)\n5. **Authenticate with LinkedIn** - Set up LinkedIn API access (one-time setup)\n6. **Publish specific post to LinkedIn** - Manually publish a post\n7. **Auto-publish all due posts** - Bulk publish ready posts\n8. **Debug LinkedIn authentication** - Troubleshoot authentication issues\n9. **Configure timezone** - Set your local timezone (shows current timezone in menu)\n10. **Check auto-scheduler status** - View detailed status of automatic scheduling\n11. **Exit** - Close the application\n\n## Automatic Scheduling\n\nPostedIn features a sophisticated automatic scheduling system:\n\n- **Timer-Based**: Uses precise Go timers instead of periodic checking\n- **Timezone-Aware**: Respects your configured timezone settings\n- **Real-Time Status**: Shows countdown timers and next scheduled publication\n- **Auto-Start**: Automatically starts when you schedule your first post\n- **Self-Cleaning**: Removes completed timers automatically\n\n### Auto-Scheduler Features\n\n- **Exact Timing**: Posts publish at precisely their scheduled time\n- **Status Display**: \n  ```\n  📅 Auto-scheduler: ACTIVE (next run: 11:35:00 WIB)\n  ```\n- **Detailed Status**: View active timers, pending posts, and next execution times\n- **Background Operation**: Runs silently in the background\n\n## Multiple Post Deletion\n\nDelete single or multiple posts efficiently:\n\n```\nDelete Posts\n============\nEnter one or more post IDs to delete:\n- Single post: 5\n- Multiple posts: 1,3,5 or 1 3 5\n\nEnter post ID(s): 1,3,5\nYou are about to delete 3 posts with IDs: [1 3 5]\nAre you sure? (y/N): y\n✅ Successfully deleted 3 post(s).\n```\n\n## Timezone Configuration\n\nConfigure your local timezone for accurate scheduling:\n\n- **Auto-Detection**: Detects your system timezone automatically\n- **Common Timezones**: Choose from predefined options\n- **Custom Timezones**: Enter any IANA timezone identifier\n- **Dynamic Updates**: Changes take effect immediately\n\n## Architecture\n\nThe application follows Go best practices with clear separation of concerns and modular design:\n\n- **Models** (`internal/models/`) - Data structures and business entities\n- **Scheduler** (`internal/scheduler/`) - Core business logic for post management\n- **CLI** (`internal/cli/`) - User interface and interaction handling\n- **Cron** (`internal/cron/`) - Automatic scheduling and timer management\n- **Config** (`internal/config/`) - Configuration and timezone management\n- **Storage** (`pkg/storage/`) - Data persistence layer (JSON file storage)\n- **LinkedIn** (`pkg/linkedin/`) - LinkedIn API client and authentication\n- **CMD** (`cmd/scheduler/`) - Application entry point and dependency wiring\n\n### Core Features\n\n1. **Schedule Posts** - Add new posts with future dates/times in your timezone\n2. **List Posts** - View all scheduled posts with status indicators and countdown timers\n3. **Check Due Posts** - Review posts ready for publishing\n4. **Delete Posts** - Remove single or multiple scheduled posts\n5. **Automatic Publishing** - Timer-based automatic posting at exact scheduled times\n6. **Timezone Management** - Configure and manage timezone settings\n7. **LinkedIn Integration** - OAuth authentication and direct posting\n8. **Persistent Storage** - JSON-based data persistence\n\nThe modular architecture makes the codebase maintainable and allows for easy extension (e.g., adding different storage backends, notification systems, or social media platforms).\n\n## Development\n\n### Code Quality\n\n- **Linting**: Uses golangci-lint for code quality checks\n- **Pre-commit Hooks**: Automatic linting on git commits\n- **Error Handling**: Comprehensive error handling throughout\n- **Logging**: Detailed logging for debugging and monitoring\n- **Testing**: Structured for easy unit testing\n\n### Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Run `make dev` to ensure code quality\n5. Submit a pull request\n\n## Troubleshooting\n\n### Common Issues\n\n1. **Timezone Issues**: Use option 9 to configure your local timezone\n2. **LinkedIn Authentication**: Use option 8 to debug authentication issues\n3. **Posts Not Publishing**: Check option 10 for auto-scheduler status\n4. **Build Issues**: Run `make clean \u0026\u0026 make build`\n\n### Debug Mode\n\nEnable verbose logging by checking the auto-scheduler status (option 10) which shows:\n- Current timezone configuration\n- Active timers and their next execution times\n- Pending posts with countdown timers\n- System status and health checks\n\n## Web Interface\n\nThe application includes a modern React-based web interface that provides all the functionality of the CLI in a user-friendly web dashboard.\n\n### Features\n- **Dashboard**: Overview of all scheduled posts with real-time status\n- **Post Management**: Create, edit, delete, and publish posts\n- **Scheduler Control**: Start/stop automatic scheduling\n- **Authentication**: LinkedIn OAuth integration\n- **Timezone Configuration**: Set and manage your timezone\n- **Real-time Updates**: Live countdown timers and status updates\n\n### Accessing the Web Interface\n\n1. **Start the web API server**:\n   ```bash\n   make run-web-api\n   # or\n   go run cmd/web-api/main.go\n   ```\n\n2. **Open in browser**: [http://localhost:8080](http://localhost:8080)\n\n3. **Alternative: Build and serve separately**:\n   ```bash\n   make build-all                    # Build everything\n   ./bin/web-api-server             # Start server\n   ```\n\n## API Documentation (Swagger/OpenAPI)\n\nThe web API is fully documented using Swagger (OpenAPI 3.0). All endpoints are versioned under `/api/v1/` for backward compatibility.\n\n### API Endpoints\n- **Base URL**: `http://localhost:8080/api/v1/`\n- **Posts**: `/api/v1/posts` - Manage scheduled posts\n- **Authentication**: `/api/v1/auth` - LinkedIn OAuth\n- **Scheduler**: `/api/v1/scheduler` - Control automatic publishing\n- **Timezone**: `/api/v1/timezone` - Configure timezone settings\n- **Callback**: `/api/v1/callback` - LinkedIn OAuth callback\n\n### How to Generate Docs\n\n- To generate or update the Swagger docs after editing API code or comments:\n  ```bash\n  make swagger\n  ```\n  \u003e **Note:** If you encounter Go module or vendoring issues, ensure your Go environment is set up correctly. The Makefile now uses the `-mod=mod` flag to avoid vendor-related errors.\n- To remove generated docs:\n  ```bash\n  make docs-clean\n  ```\n\n### How to View the API Docs\n\n1. Start the web API server:\n   ```bash\n   make run-web-api\n   ```\n2. Open your browser and go to:\n   [http://localhost:8080/swagger/index.html](http://localhost:8080/swagger/index.html)\n\nThis interactive UI allows you to try out all endpoints, see request/response schemas, and explore the API.\n\n### API Versioning\n\nThe API uses semantic versioning with URL-based versioning:\n- **Current version**: `v1`\n- **Full endpoint format**: `http://localhost:8080/api/v1/{endpoint}`\n- **Backward compatibility**: Maintained across minor version updates","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelwp%2Fpostedin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelwp%2Fpostedin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelwp%2Fpostedin/lists"}