I was searching for an open source repository that schedules and posts on social media. I found . You can 📨 schedule social media and articles. Exchange or buy posts from other members 👨🏻💻. Monitor your GitHub trending, and so much more 📈.
The following are some interesting things I learnt from this
Gitroom uses the following tech stack:
- NX (Monorepo)
- NextJS (React)
- NestJS
- Prisma (Default to PostgreSQL)
- Redis
- Resend (emails notifications)
It has folders named as frontend, backend, cron etc.,
I wondered for quite some time now, if we could use our own backend when you are already using the Next.js, a “full stack” react framework but, I kept seeing people advising to use your custom backend when you need advanced features like cron, web sockets etc., on Reddit. Now that I found Gitroom that demonstrates the custom backend usage along with Next.js and cron, I have a good feeling that you could learn some advanced patterns studying this repository.
2. A note about customFetch
The following code snippet is picked from
export const customFetch = (
params: Params,
auth?: string,
showorg?: string
) => {
return async function newFetch(url: string, options: RequestInit = {}) {
const newRequestObject = await params?.beforeRequest?.(url, options);
const fetchRequest = await fetch(params.baseUrl + url, {
credentials: 'include',
…(newRequestObject || options),
headers: {
…(auth ? { auth } : {}),
…(showorg ? { showorg } : {}),
…(options.body instanceof FormData
? {}
: { 'Content-Type': 'application/json' }),
Accept: 'application/json',
…options?.headers,
},
// @ts-ignore
…(!options.next && options.cache !== 'force-cache'
? { cache: options.cache || 'no-store' }
: {}),
});
if (
!params?.afterRequest ||
(await params?.afterRequest?.(url, options, fetchRequest))
) {
return fetchRequest;
}
// @ts-ignore
return new Promise((res) => {}) as Response;
};
};
Why???, I don’t know the answer yet but, I can tell there is “beforeRequest” and “afterRequest” processing happening based on the above code snippet
3. The way the files are named.
About me:
Website:
Github:
SOCIAL SHARE CARD GENERATOR