Api Keys Finished
Starting the day with adding the client. I expanded my keycloak init script with the api client creation. I avoid using the web ui so I can easily reproduce it once I decide to deploy. Also serves as a kind of documentation of what needs to be done.
Setting up the client was easy enough, now to develop the whole backend.
Took much more work than I anticipated. I took the time to refactor and clean up my config before adding the new code.
Finally wired everything up, tested, fixed some issues, and now it's working as intended! Sweet!
<video controls src="https://content.devjourney.io/kova98/0abd437d-2ce4-4ac4-b7eb-8feaebabbcd1.mp4" title="Title"></video>
Next up, I need to do a few more things before I go public.
1. Content Management
Currently, I manually upload images and videos that I want to post to X and LinkedIn, and none are available in my diary. I want the content to be as easy to add as copy pasting it in my markdown editor, and it being uploaded along with the text content.
I need this content to be available for any social media content I post. I also want to automatically generate drafts of these posts, for me to verify and post at a certain schedule.
I'll have to implement tools to modify them and adapt them for different purposes. I'll also support templates that generate ,media content for when I have nothing to show. like project stats.
Not all of this needs to be done right away, but I need to at least be able to upload content.
2. Submit Script
This will be a rewrite of my existing script that takes everything I push in my diary repo and uploads it to the diary database.
The new version will work with the devjourney api, and will support uploading content.
3. Infrastructure
I will make the CI/CD properly from the start. This includes automatic versioning and deployment for both backend and frontend. Frontend is handled pretty well by Vercel already, but backend I'll have to do from scratch.
I also want Grafana logs from the very start.
All infra work I do, I will try and make reproducible. This project will be a template that I will use to build all future projects, so I'll do everything properly and document the process. As much as I can automate, I will automate.
Content Management brainstorming
I will start with Content Management first. For now, I only need a way to upload and access content.
Some considerations:
- what information do i need to store?
- userId
- contentType
- fileSize
- contentType
- url
- date created
- what will the url look like?
- content.devjourney.io/{userId}/{fileName}
- how will i name the files?
- not sure
- where will i store the files?
- on my server for now, with option to migrate to s3 in the future
- i have a big machine with tons of storage that i want to use up for anything infrastructure wise. I don't want to use cloud tools unless i absolutely have to.
I will have a new endpoint:
POST /content
that will save the file and respond with a url.
{
"url": "https://content.devjourney.io/kova98/123e4567-e89b-12d3-a456-426614174000.jpg"
}
Right now, the api service will simply write to the filesystem. I don't want to overcomplicate things, and switching to S3 should be easy if I ever have to do it. Honestly, that will probably never happen, as I'm the only one using this, but I'm still considering it since I'm doing things "properly".
To serve the content, I will configure the nginx I already have running to serve from the directory I write in.
I'm thinking in advance about the content processing and generation. I will probably have to add a job system and do that in the background. Idk. we'll see. Let's implement this simple first step first.
- new endpoint
POST /content
Did a lot of work on the endpoint, almost finished writing, but too tired to think clearly. I'm calling it a night.